nou: modificat el valor de velocitat en la creació dels globos verds. i tornat a deixar com estava
This commit is contained in:
@@ -122,6 +122,8 @@ class Balloon {
|
||||
|
||||
// --- Setters ---
|
||||
void setVelY(float vel_y) { vy_ = vel_y; }
|
||||
void setVelX(float vel_x) { vx_ = vel_x; }
|
||||
void alterVelX(float percent) {vx_ *= percent; }
|
||||
void setGameTempo(float tempo) { game_tempo_ = tempo; }
|
||||
void setInvulnerable(bool value) { invulnerable_ = value; }
|
||||
void setBouncingSound(bool value) { sound_.bouncing_enabled = value; }
|
||||
|
||||
@@ -217,9 +217,22 @@ void BalloonManager::createChildBalloon(const std::shared_ptr<Balloon> &balloon,
|
||||
// Crea el globo
|
||||
auto b = createBalloon(config);
|
||||
|
||||
// Establece parametros (deltaTime en segundos - velocidades en pixels/segundo)
|
||||
constexpr float VEL_Y_BALLOON_PER_S = -150.0F; // -2.50 pixels/frame convertido a pixels/segundo (-2.50 * 60 = -150)
|
||||
b->setVelY(b->getType() == Balloon::Type::BALLOON ? VEL_Y_BALLOON_PER_S : Balloon::VELX_NEGATIVE * 2.0F);
|
||||
// Establece parametros
|
||||
constexpr float VEL_Y_BALLOON_PER_S = -150.0F;
|
||||
switch (b->getType()) {
|
||||
case Balloon::Type::BALLOON: {
|
||||
b->setVelY(VEL_Y_BALLOON_PER_S);
|
||||
break;
|
||||
}
|
||||
case Balloon::Type::FLOATER: {
|
||||
const float MODIFIER = (rand() % 2 == 0) ? 1.0F : 1.0F;
|
||||
b->setVelY(Balloon::VELX_NEGATIVE * 2.0F * MODIFIER);
|
||||
(rand() % 2 == 0) ? b->alterVelX(1.0F) : b->alterVelX(1.0F);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Herencia de estados
|
||||
if (balloon->isStopped()) { b->stop(); }
|
||||
|
||||
Reference in New Issue
Block a user