delta-time: tabe.cpp
This commit is contained in:
@@ -26,8 +26,9 @@ class Tabe {
|
||||
~Tabe() = default;
|
||||
|
||||
// --- Métodos principales ---
|
||||
void update(); // Actualiza la lógica
|
||||
void render(); // Dibuja el objeto
|
||||
void update(); // Actualiza la lógica (frame-based)
|
||||
void update(float deltaTime); // Actualiza la lógica (time-based)
|
||||
void render(); // Dibuja el objeto
|
||||
void enable(); // Habilita el objeto
|
||||
void setState(State state); // Establece el estado
|
||||
auto tryToGetBonus() -> bool; // Intenta obtener el bonus
|
||||
@@ -130,21 +131,23 @@ class Tabe {
|
||||
float speed_ = 0.0F; // Velocidad de movimiento
|
||||
float accel_ = 0.0F; // Aceleración
|
||||
int fly_distance_ = 0; // Distancia de vuelo
|
||||
int waiting_counter_ = 0; // Tiempo que pasa quieto
|
||||
float waiting_counter_ = 0; // Tiempo que pasa quieto
|
||||
bool enabled_ = false; // Indica si el objeto está activo
|
||||
Direction direction_ = Direction::TO_THE_LEFT; // Dirección actual
|
||||
Direction destiny_ = Direction::TO_THE_LEFT; // Destino
|
||||
State state_ = State::FLY; // Estado actual
|
||||
int hit_counter_ = 0; // Contador para el estado HIT
|
||||
float hit_counter_ = 0; // Contador para el estado HIT
|
||||
int number_of_hits_ = 0; // Cantidad de disparos recibidos
|
||||
bool has_bonus_ = true; // Indica si aún tiene el bonus para soltar
|
||||
Timer timer_; // Temporizador para gestionar la aparición
|
||||
|
||||
// --- Métodos internos ---
|
||||
void move(); // Mueve el objeto
|
||||
void move(); // Mueve el objeto (frame-based)
|
||||
void move(float deltaTime); // Mueve el objeto (time-based)
|
||||
void shiftSprite() { sprite_->setPos(x_, y_); } // Actualiza la posición del sprite
|
||||
void setRandomFlyPath(Direction direction, int length); // Establece un vuelo aleatorio
|
||||
void updateState(); // Actualiza el estado
|
||||
void updateState(); // Actualiza el estado (frame-based)
|
||||
void updateState(float deltaTime); // Actualiza el estado (time-based)
|
||||
void updateTimer(); // Actualiza el temporizador
|
||||
void disable(); // Deshabilita el objeto
|
||||
};
|
||||
Reference in New Issue
Block a user