coin counter method created

This commit is contained in:
2022-06-25 20:54:47 -04:00
parent a439748a34
commit 3a58777773
3 changed files with 154 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
#include "coin/CoinCounter.h"
#include <Control.hpp>
using namespace godot;
void CoinCounter::_register_methods()
{
register_method("_state_enter", &CoinCounter::_state_enter);
register_method("_state_exit", &CoinCounter::_state_exit);
register_method("_on_body_entered", &CoinCounter::_on_CoinHUD_ready);
}
CoinCounter::CoinCounter()
{
}
CoinCounter::~CoinCounter()
{
}
void CoinCounter::_init()
{
}
void CoinCounter::_state_enter()
{
}
void CoinCounter::_state_exit()
{
}
void CoinCounter::_on_CoinHUD_ready()
{
}

View File

@@ -0,0 +1,77 @@
#ifndef ALAI_COIN_COUNTER
#define ALAI_COIN_COUNTER
#include "state_machine/State.h"
#include <Godot.hpp>
#include <Node.hpp>
#include <AnimatedSprite.hpp>
namespace godot
{
/**
* @brief This class controls what happens when the Coin is in the collected state.
*
*/
class CoinCounter : public State
{
GODOT_CLASS(CoinCounter, State)
private:
/**
* @brief The animated sprite of the Coin.
*
*/
AnimatedSprite *animated_sprite;
public:
/**
* @brief This method registers classes with Godot.
*
* @details This method registers methods, properties, and signals with the Godot engine.
*/
static void _register_methods();
/**
* @brief Construct a new CoinCounter object.
*
*/
CoinCounter();
/**
* @brief Destroy the CoinCounter object.
*
*/
~CoinCounter();
/**
* @brief Initialize the class from Godot.
*
* @details This method is called just once when the Godot engine connects to the instance of the class.
*/
void _init();
/**
* @brief Called when the collected state of the coin is entered.
*
*/
void _state_enter();
/**
* @brief Called when the collected state of the coin is exited.
*
*/
void _state_exit();
/**
* @brief Called when the animation of the collected coin has finished.
*
*/
void _on_CoinHUD_ready();
};
}
#endif