add documentation
This commit is contained in:
@@ -7,35 +7,80 @@
|
||||
#include <Input.hpp>
|
||||
#include <AnimatedSprite.hpp>
|
||||
|
||||
/**
|
||||
* @brief This is the godot namespace for all the code included in the library.
|
||||
*
|
||||
* @details This namespace is used a prefix when the Godot engine looks for classes, methods, and properties.
|
||||
*/
|
||||
namespace godot
|
||||
{
|
||||
namespace player
|
||||
{
|
||||
/**
|
||||
* @brief This class controls what happens when the player is in a falling state.
|
||||
*
|
||||
*/
|
||||
class PlayerFall : public State
|
||||
{
|
||||
GODOT_CLASS(PlayerFall, State)
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Input singleton.
|
||||
*
|
||||
*/
|
||||
Input *_input;
|
||||
|
||||
/**
|
||||
* @brief The animated sprite connected to the player.
|
||||
*
|
||||
*/
|
||||
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 Player Fall object.
|
||||
*
|
||||
*/
|
||||
PlayerFall();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Player Fall object.
|
||||
*
|
||||
*/
|
||||
~PlayerFall();
|
||||
|
||||
/**
|
||||
* @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 fall state is entered.
|
||||
*
|
||||
*/
|
||||
void _state_enter();
|
||||
|
||||
/**
|
||||
* @brief Called when the fall state is exited.
|
||||
*
|
||||
*/
|
||||
void _state_exit();
|
||||
|
||||
/**
|
||||
* @brief The physics processed every delta time.
|
||||
*
|
||||
* @param[in] delta The time since the method was last run.
|
||||
*/
|
||||
void _physics_process(float delta);
|
||||
};
|
||||
}
|
||||
|
@@ -12,31 +12,70 @@ namespace godot
|
||||
{
|
||||
namespace player
|
||||
{
|
||||
/**
|
||||
* @brief This class controls what happens when the player is in the idle state.
|
||||
*
|
||||
*/
|
||||
class PlayerIdle : public State
|
||||
{
|
||||
GODOT_CLASS(PlayerIdle, State)
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Input singleton.
|
||||
*
|
||||
*/
|
||||
Input *_input;
|
||||
/**
|
||||
* @brief The animated sprite of the player.
|
||||
*
|
||||
*/
|
||||
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 Player Idle object.
|
||||
*
|
||||
*/
|
||||
PlayerIdle();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Player Idle object.
|
||||
*
|
||||
*/
|
||||
~PlayerIdle();
|
||||
|
||||
/**
|
||||
* @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 idle state is entered.
|
||||
*
|
||||
*/
|
||||
void _state_enter();
|
||||
|
||||
/**
|
||||
* @brief Called when the idle state is exited.
|
||||
*
|
||||
*/
|
||||
void _state_exit();
|
||||
|
||||
/**
|
||||
* @brief The physics processed every delta time.
|
||||
*
|
||||
* @param[in] delta The time since the method was last run.
|
||||
*/
|
||||
void _physics_process(float delta);
|
||||
};
|
||||
}
|
||||
|
@@ -11,32 +11,78 @@ namespace godot
|
||||
{
|
||||
namespace player
|
||||
{
|
||||
/**
|
||||
* @brief This class control what happens when the player is in the jump state.
|
||||
*
|
||||
*/
|
||||
class PlayerJump : public State
|
||||
{
|
||||
GODOT_CLASS(PlayerJump, State)
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Input singleton.
|
||||
*
|
||||
*/
|
||||
Input *_input;
|
||||
/**
|
||||
* @brief The animated sprite connected to the player.
|
||||
*
|
||||
*/
|
||||
AnimatedSprite *animated_sprite;
|
||||
/**
|
||||
* @brief If the player has already performed a double jump or not.
|
||||
*
|
||||
*/
|
||||
bool double_jumped;
|
||||
|
||||
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 Player Jump object.
|
||||
*
|
||||
*/
|
||||
PlayerJump();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Player Jump object.
|
||||
*
|
||||
*/
|
||||
~PlayerJump();
|
||||
|
||||
/**
|
||||
* @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 player enters the jump state.
|
||||
*
|
||||
* @details If the previous state was the jump state, a double jump was performed.
|
||||
*
|
||||
* @param[in] state The previous state before this one was entered.
|
||||
*/
|
||||
void _state_enter(const String state);
|
||||
|
||||
/**
|
||||
* @brief Called when the player exits the jump state.
|
||||
*
|
||||
*/
|
||||
void _state_exit();
|
||||
|
||||
/**
|
||||
* @brief The physics processed every delta time.
|
||||
*
|
||||
* @param[in] delta The time since the method was last run.
|
||||
*/
|
||||
void _physics_process(float delta);
|
||||
};
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ void PlayerMove::_init()
|
||||
_input = Input::get_singleton();
|
||||
}
|
||||
|
||||
void PlayerMove::_state_enter(String state, Array args)
|
||||
void PlayerMove::_state_enter()
|
||||
{
|
||||
animated_sprite = get_parent()->get_node<AnimatedSprite>("AnimatedSprite");
|
||||
animated_sprite->set_animation("move");
|
||||
|
@@ -11,34 +11,71 @@ namespace godot
|
||||
{
|
||||
namespace player
|
||||
{
|
||||
/**
|
||||
* @brief This class controls what happens when the player is in the move state.
|
||||
*
|
||||
*/
|
||||
class PlayerMove : public State
|
||||
{
|
||||
GODOT_CLASS(PlayerMove, State)
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Input singleton.
|
||||
*
|
||||
*/
|
||||
Input *_input;
|
||||
/**
|
||||
* @brief The animated sprite of the player.
|
||||
*
|
||||
*/
|
||||
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 Player Move object.
|
||||
*
|
||||
*/
|
||||
PlayerMove();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Player Move object.
|
||||
*
|
||||
*/
|
||||
~PlayerMove();
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
void _state_enter(String state, Array args);
|
||||
/**
|
||||
* @brief Called when the player enters the move state.
|
||||
*
|
||||
*/
|
||||
void _state_enter();
|
||||
|
||||
/**
|
||||
* @brief Called when the player exists the move state.
|
||||
*
|
||||
*/
|
||||
void _state_exit();
|
||||
|
||||
/**
|
||||
* @brief The physics processed every delta time.
|
||||
*
|
||||
* @param[in] delta The time since the method was last run.
|
||||
*/
|
||||
void _physics_process(float delta);
|
||||
|
||||
Vector2 move_player(Vector2 velocity);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user