cleanup time-based: elimina entitats frame-based (Bullet/Item/Player/Balloon), VELX en px/s, Game::popBalloon amb vel en px/s
This commit is contained in:
@@ -39,9 +39,9 @@ class Balloon {
|
||||
static constexpr int BALLOON_CLASS = 0;
|
||||
static constexpr int HEXAGON_CLASS = 1;
|
||||
|
||||
// Velocidad del globo
|
||||
static constexpr float VELX_POSITIVE = 0.7F;
|
||||
static constexpr float VELX_NEGATIVE = -0.7F;
|
||||
// Velocitat horitzontal en px/s (era 0.7 px/frame * 60).
|
||||
static constexpr float VELX_POSITIVE = 42.0F;
|
||||
static constexpr float VELX_NEGATIVE = -42.0F;
|
||||
|
||||
// Velocidades a las que se mueven los globos
|
||||
static constexpr float SPEED_1 = 0.60F;
|
||||
@@ -68,12 +68,10 @@ class Balloon {
|
||||
|
||||
void allignTo(int x); // Centra el globo en la posición X
|
||||
void render(); // Pinta el globo en la pantalla
|
||||
void move(); // Actualiza la posición y estados del globo (frame-based)
|
||||
void move(float dt_s); // Actualiza la posición y estados del globo (time-based)
|
||||
void move(float dt_s); // Actualiza la posición y estados del globo
|
||||
void disable(); // Deshabilita el globo y pone a cero todos los valores
|
||||
void pop(); // Explosiona el globo
|
||||
void update(); // Actualiza al globo (frame-based)
|
||||
void update(float dt_s); // Actualiza al globo (time-based)
|
||||
void update(float dt_s); // Actualiza al globo
|
||||
|
||||
[[nodiscard]] auto isEnabled() const -> bool; // Comprueba si el globo está habilitado
|
||||
[[nodiscard]] auto isStopped() const -> bool; // Obtiene del valor de la variable
|
||||
@@ -85,7 +83,6 @@ class Balloon {
|
||||
|
||||
[[nodiscard]] auto getPosX() const -> float; // Obtiene del valor de la variable
|
||||
[[nodiscard]] auto getPosY() const -> float; // Obtiene del valor de la variable
|
||||
[[nodiscard]] auto getVelY() const -> float; // Obtiene del valor de la variable
|
||||
[[nodiscard]] auto getWidth() const -> int; // Obtiene del valor de la variable
|
||||
[[nodiscard]] auto getHeight() const -> int; // Obtiene del valor de la variable
|
||||
[[nodiscard]] auto getKind() const -> int; // Obtiene del valor de la variable
|
||||
@@ -137,16 +134,11 @@ class Balloon {
|
||||
float pos_y_; // Posición en el eje Y
|
||||
Uint8 width_; // Ancho
|
||||
Uint8 height_; // Alto
|
||||
float vel_x_; // Velocidad en X (frame-based: px/frame)
|
||||
float vel_y_; // Velocidad en Y (frame-based: px/frame)
|
||||
float gravity_; // Aceleración Y (frame-based: px/frame²)
|
||||
float default_vel_y_; // Velocitat inicial al rebotar contra el terra (frame-based)
|
||||
float max_vel_y_; // Velocitat màxima en Y (frame-based)
|
||||
float vel_x_s_{0.0F}; // Velocidad en X (time-based: px/s)
|
||||
float vel_y_s_{0.0F}; // Velocidad en Y (time-based: px/s)
|
||||
float gravity_s_{0.0F}; // Aceleración Y (time-based: px/s²)
|
||||
float default_vel_y_s_{0.0F}; // Velocitat inicial al rebotar (time-based)
|
||||
float max_vel_y_s_{0.0F}; // Velocitat màxima en Y (time-based)
|
||||
float vel_x_s_{0.0F}; // Velocidad en X (px/s)
|
||||
float vel_y_s_{0.0F}; // Velocidad en Y (px/s)
|
||||
float gravity_s_{0.0F}; // Aceleración Y (px/s²)
|
||||
float default_vel_y_s_{0.0F}; // Velocitat inicial al rebotar (px/s)
|
||||
float max_vel_y_s_{0.0F}; // Velocitat màxima en Y (px/s, no aplicada en time-based actual)
|
||||
bool being_created_; // Indica si el globo se está creando
|
||||
bool blinking_; // Indica si el globo está intermitente
|
||||
bool enabled_; // Indica si el globo esta activo
|
||||
@@ -155,40 +147,33 @@ class Balloon {
|
||||
bool stopped_; // Indica si el globo está parado
|
||||
bool visible_; // Indica si el globo es visible
|
||||
Circle collider_; // Circulo de colisión del objeto
|
||||
Uint16 creation_counter_; // Temporizador (frame-based)
|
||||
Uint16 creation_counter_; // Temporizador (frames, derivat de creation_counter_s_ per a render alpha)
|
||||
Uint16 creation_counter_ini_; // Valor inicial del temporizador (frames)
|
||||
float creation_counter_s_{0.0F}; // Temporizador (time-based)
|
||||
float creation_counter_s_{0.0F}; // Temporizador (font de veritat, segons)
|
||||
float creation_counter_ini_s_{0.0F}; // Valor inicial del temporizador (segons)
|
||||
float creation_phase_s_{0.0F}; // Acumulador de fase per als steps de creació (time-based)
|
||||
float creation_phase_s_{0.0F}; // Acumulador de fase per als steps de creació
|
||||
Uint16 score_; // Puntos que da el globo al ser destruido
|
||||
Uint16 stopped_counter_; // Contador (frame-based)
|
||||
float stopped_counter_s_{0.0F}; // Contador (time-based)
|
||||
Uint16 stopped_counter_; // Contador (frames, derivat de stopped_counter_s_)
|
||||
float stopped_counter_s_{0.0F}; // Contador (font de veritat, segons)
|
||||
Uint8 kind_; // Tipo de globo
|
||||
Uint8 menace_; // Cantidad de amenaza que genera el globo
|
||||
Uint32 counter_; // Contador interno (legacy, no usat per cap lector)
|
||||
float travel_y_; // Acumulador per a aplicar la gravetat (frame-based)
|
||||
float speed_; // Tempo del joc (multiplicador adimensional, frame i time-based)
|
||||
float speed_; // Tempo del joc (multiplicador adimensional)
|
||||
Uint8 size_; // Tamaño del globo
|
||||
Uint8 power_; // Cantidad de poder que alberga el globo
|
||||
Bouncing bouncing_; // Contiene las variables para el efecto de rebote
|
||||
float bounce_phase_s_{0.0F}; // Fase del bounce (time-based)
|
||||
float bounce_phase_s_{0.0F}; // Fase del bounce
|
||||
|
||||
void updateColliders(); // Alinea el circulo de colisión con la posición del objeto globo
|
||||
void bounceStart(); // Activa el efecto
|
||||
void bounceStop(); // Detiene el efecto
|
||||
void updateBounce(); // Aplica el efecto (frame-based)
|
||||
void updateBounce(float dt_s); // Aplica el efecto (time-based)
|
||||
void updateAnimation(); // Establece la animación correspondiente (frame-based)
|
||||
void updateAnimation(float dt_s); // Establece la animación correspondiente (time-based)
|
||||
void updateBounce(float dt_s); // Aplica el efecto
|
||||
void updateAnimation(float dt_s); // Establece la animación correspondiente
|
||||
void setBeingCreated(bool value); // Establece el valor de la variable
|
||||
|
||||
void updateState(); // Actualiza los estados del globo (frame-based)
|
||||
void updateState(float dt_s); // Actualiza los estados del globo (time-based)
|
||||
void updateState(float dt_s); // Actualiza los estados del globo
|
||||
|
||||
// Helpers de updateState, uno por cada rama de estado
|
||||
void updateStatePopping();
|
||||
void updateStateBeingCreated();
|
||||
void updateStateBeingCreated(float dt_s);
|
||||
void updateStateStopped();
|
||||
void updateStateStopped(float dt_s);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user