El malo nou ja suca cosetes, falta ajustar un poc els paràmetres
This commit is contained in:
@@ -9,6 +9,12 @@ enum class TabeDirection : int
|
||||
TO_THE_RIGHT = 1,
|
||||
};
|
||||
|
||||
enum class TabeState : int
|
||||
{
|
||||
FLY = 0,
|
||||
HIT = 1,
|
||||
};
|
||||
|
||||
// Clase Tabe
|
||||
class Tabe
|
||||
{
|
||||
@@ -21,15 +27,18 @@ private:
|
||||
std::unique_ptr<AnimatedSprite> sprite_; // Sprite con los graficos y animaciones
|
||||
|
||||
// Variables
|
||||
float x_ = 0; // Posición del objeto
|
||||
float y_ = 0; // Posición del objeto
|
||||
float speed_ = 0.0f; // Velocidad de movimiento del objeto
|
||||
float accel_ = 0.0f; // Aceleración del objeto
|
||||
int fly_distance_ = 0; // Distancia de vuelo
|
||||
int waiting_counter_ = 0; // Tiempo que pasa quieto el objeto
|
||||
bool enabled_ = false; // Indica si el objeto está activo
|
||||
TabeDirection direction_; // Dirección del objeto
|
||||
TabeDirection destiny_; // Destino del objeto
|
||||
float x_ = 0; // Posición del objeto
|
||||
float y_ = 0; // Posición del objeto
|
||||
float speed_ = 0.0f; // Velocidad de movimiento del objeto
|
||||
float accel_ = 0.0f; // Aceleración del objeto
|
||||
int fly_distance_ = 0; // Distancia de vuelo
|
||||
int waiting_counter_ = 0; // Tiempo que pasa quieto el objeto
|
||||
bool enabled_ = false; // Indica si el objeto está activo
|
||||
TabeDirection direction_; // Dirección del objeto
|
||||
TabeDirection destiny_; // Destino del objeto
|
||||
TabeState state_ = TabeState::FLY; // Estado
|
||||
int hit_counter = 0; // Contador para el estado HIT
|
||||
bool has_bonus_ = true; // Indica si el Tabe aun tiene el bonus para soltar
|
||||
|
||||
// Mueve el objeto
|
||||
void move();
|
||||
@@ -40,6 +49,9 @@ private:
|
||||
// Establece un vuelo aleatorio
|
||||
void setRandomFlyPath(TabeDirection direction, int lenght);
|
||||
|
||||
// Actualiza el estado
|
||||
void updateState();
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Tabe();
|
||||
@@ -55,4 +67,16 @@ public:
|
||||
|
||||
// Habilita el objeto
|
||||
void enable();
|
||||
|
||||
// Establece el estado
|
||||
void setState(TabeState state);
|
||||
|
||||
// Intenta obtener el bonus
|
||||
bool tryToGetBonus();
|
||||
|
||||
// Obtiene el area de colisión
|
||||
SDL_Rect &getCollider() { return sprite_->getRect(); }
|
||||
|
||||
// Getters
|
||||
bool isEnabled() const { return enabled_; }
|
||||
};
|
||||
Reference in New Issue
Block a user