This commit is contained in:
2024-10-23 18:29:52 +02:00
parent 95478134dd
commit 6e2f80d8ce
26 changed files with 232 additions and 290 deletions

View File

@@ -13,17 +13,10 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
pos_y_(y),
vel_x_(vel_x),
being_created_(creation_timer > 0),
blinking_(false),
enabled_(true),
invulnerable_(creation_timer > 0),
stopped_(true),
visible_(true),
creation_counter_(creation_timer),
creation_counter_ini_(creation_timer),
stopped_counter_(0),
kind_(kind),
counter_(0),
travel_y_(1.0f),
speed_(speed)
{
@@ -227,23 +220,9 @@ Balloon::Balloon(float x, float y, Uint8 kind, float vel_x, float speed, Uint16
break;
}
// Valores para el efecto de rebote
bouncing_.enabled = false;
bouncing_.counter = 0;
bouncing_.speed = 2;
bouncing_.zoomW = 1.0f;
bouncing_.zoomH = 1.0f;
bouncing_.despX = 0.0f;
bouncing_.despY = 0.0f;
bouncing_.w = {1.10f, 1.05f, 1.00f, 0.95f, 0.90f, 0.95f, 1.00f, 1.02f, 1.05f, 1.02f};
bouncing_.h = {0.90f, 0.95f, 1.00f, 1.05f, 1.10f, 1.05f, 1.00f, 0.98f, 0.95f, 0.98f};
// Configura el sprite
sprite_->setPos({static_cast<int>(pos_x_), static_cast<int>(pos_y_), width_, height_});
// Tamaño del circulo de colisión
collider_.r = width_ / 2;
// Alinea el circulo de colisión con el objeto
updateColliders();
}
@@ -726,8 +705,8 @@ Circle &Balloon::getCollider()
// Alinea el circulo de colisión con la posición del objeto globo
void Balloon::updateColliders()
{
collider_.x = Uint16(pos_x_ + collider_.r);
collider_.y = pos_y_ + collider_.r;
collider_.x = static_cast<int>(pos_x_ + collider_.r);
collider_.y = static_cast<int>(pos_y_ + collider_.r);
}
// Obtiene le valor de la variable