new: el jugador explota els globos per contacte si estos estan parats

This commit is contained in:
2025-07-14 14:08:08 +02:00
parent de560ee7e2
commit 3d26a3022c
5 changed files with 36 additions and 17 deletions

View File

@@ -195,7 +195,7 @@ void Player::move()
{
if (player_sprite_->getVelY() < 2.0f)
{
// Si la velocidad de rebote es baja, termina de rebotar y cambia de estado
// Si la velocidad de rebote es baja, lo detiene y cambia de estado
const auto nextPlayerStatus = IsEligibleForHighScore() ? PlayerState::ENTERING_NAME : PlayerState::CONTINUE;
demo_ ? setPlayingState(PlayerState::LYING_ON_THE_FLOOR_FOREVER) : setPlayingState(nextPlayerStatus);
pos_x_ = player_sprite_->getPosX();
@@ -210,6 +210,7 @@ void Player::move()
player_sprite_->setPosY(play_area_.h - HEIGHT_);
player_sprite_->setVelY(player_sprite_->getVelY() * -0.5f);
player_sprite_->setVelX(player_sprite_->getVelX() * 0.75f);
player_sprite_->setAnimationSpeed(player_sprite_->getAnimationSpeed() * 2);
playSound("jump.wav");
}
}
@@ -627,6 +628,8 @@ void Player::setPlayingState(PlayerState state)
case PlayerState::ROLLING:
{
// Activa la animación de rodar
player_sprite_->setCurrentAnimation("rolling");
player_sprite_->setAnimationSpeed(4);
player_sprite_->setAccelY(0.2f);
player_sprite_->setVelY(-6.6f);
(rand() % 2 == 0) ? player_sprite_->setVelX(3.3f) : player_sprite_->setVelX(-3.3f);
@@ -635,6 +638,8 @@ void Player::setPlayingState(PlayerState state)
case PlayerState::TITLE_ANIMATION:
{
// Activa la animación de rodar
player_sprite_->setCurrentAnimation("rolling");
player_sprite_->setAnimationSpeed(5);
player_sprite_->setAccelY(0.2f);
player_sprite_->setVelY(-6.6f);
playSound("voice_thankyou.wav");