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:
@@ -19,7 +19,6 @@ Bullet::Bullet(int x, int y, Bullet::Kind kind, bool powered_up, int owner, Text
|
||||
height_ = 10;
|
||||
|
||||
// Velocidad inicial en el eje Y
|
||||
vel_y_ = -3;
|
||||
vel_y_s_ = VEL_Y_PX_PER_S;
|
||||
|
||||
// Tipo de bala
|
||||
@@ -32,7 +31,6 @@ Bullet::Bullet(int x, int y, Bullet::Kind kind, bool powered_up, int owner, Text
|
||||
switch (kind) {
|
||||
case Bullet::Kind::UP:
|
||||
// Establece la velocidad inicial
|
||||
vel_x_ = 0;
|
||||
vel_x_s_ = 0.0F;
|
||||
|
||||
// Rectangulo con los gráficos del objeto
|
||||
@@ -45,7 +43,6 @@ Bullet::Bullet(int x, int y, Bullet::Kind kind, bool powered_up, int owner, Text
|
||||
|
||||
case Bullet::Kind::LEFT:
|
||||
// Establece la velocidad inicial
|
||||
vel_x_ = -2;
|
||||
vel_x_s_ = VEL_X_LEFT_PX_PER_S;
|
||||
|
||||
// Rectangulo con los gráficos del objeto
|
||||
@@ -58,7 +55,6 @@ Bullet::Bullet(int x, int y, Bullet::Kind kind, bool powered_up, int owner, Text
|
||||
|
||||
case Bullet::Kind::RIGHT:
|
||||
// Establece la velocidad inicial
|
||||
vel_x_ = 2;
|
||||
vel_x_s_ = VEL_X_RIGHT_PX_PER_S;
|
||||
|
||||
// Rectangulo con los gráficos del objeto
|
||||
@@ -90,46 +86,7 @@ void Bullet::render() {
|
||||
sprite_->render();
|
||||
}
|
||||
|
||||
// Actualiza la posición y estado del objeto en horizontal
|
||||
auto Bullet::move() -> MoveResult {
|
||||
// Variable con el valor de retorno
|
||||
MoveResult msg = MoveResult::OK;
|
||||
|
||||
// Mueve el objeto a su nueva posición
|
||||
pos_x_ += vel_x_;
|
||||
|
||||
// Si el objeto se sale del area de juego por los laterales
|
||||
if ((pos_x_ < PLAY_AREA_LEFT - width_) || (pos_x_ > PLAY_AREA_RIGHT)) {
|
||||
// Se deshabilita
|
||||
kind_ = Bullet::Kind::NONE;
|
||||
|
||||
// Mensaje de salida
|
||||
msg = MoveResult::OUT;
|
||||
}
|
||||
|
||||
// Mueve el objeto a su nueva posición en vertical
|
||||
pos_y_ += vel_y_;
|
||||
|
||||
// Si el objeto se sale del area de juego por la parte superior
|
||||
if (pos_y_ < PLAY_AREA_TOP - height_) {
|
||||
// Se deshabilita
|
||||
kind_ = Bullet::Kind::NONE;
|
||||
|
||||
// Mensaje de salida
|
||||
msg = MoveResult::OUT;
|
||||
}
|
||||
|
||||
// Actualiza la posición del sprite
|
||||
sprite_->setPosX(pos_x_);
|
||||
sprite_->setPosY(pos_y_);
|
||||
|
||||
// Alinea el circulo de colisión con el objeto
|
||||
shiftColliders();
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
// Actualiza la posición y estado del objeto (time-based)
|
||||
// Actualiza la posición y estado del objeto
|
||||
auto Bullet::move(float dt_s) -> MoveResult {
|
||||
MoveResult msg = MoveResult::OK;
|
||||
|
||||
@@ -189,11 +146,6 @@ void Bullet::setPosY(int y) {
|
||||
pos_y_f_ = static_cast<float>(y);
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
auto Bullet::getVelY() const -> int {
|
||||
return vel_y_;
|
||||
}
|
||||
|
||||
// Obtiene el valor de la variable
|
||||
auto Bullet::getKind() const -> Bullet::Kind {
|
||||
return kind_;
|
||||
|
||||
Reference in New Issue
Block a user