Afegida animacioneta pa quan continues

This commit is contained in:
2025-08-14 12:55:29 +02:00
parent a388005968
commit ca6edcccc0
4 changed files with 28 additions and 3 deletions

View File

@@ -113,6 +113,13 @@ loop=-1
frames=42,42,42,42,42,42,43,44,45,46,46,46,46,46,46,45,45,45,46,46,46,45,45,45,44,43,42,42,42
[/animation]
[animation]
name=thank_you
speed=3
loop=-1
frames=42,42,43,44,45,46,46,46,45,44
[/animation]
[animation]
name=dizzy
speed=5

View File

@@ -181,6 +181,9 @@ void Player::move() {
case State::WAITING:
handleWaitingMovement();
break;
case State::THANK_YOU:
handleThankYouMovement();
break;
default:
break;
}
@@ -198,6 +201,13 @@ void Player::handlePlayingMovement() {
shiftSprite();
}
void Player::handleThankYouMovement() {
// Si termina la animacion, cambia de estado
if (player_sprite_->animationIsCompleted()) {
setPlayingState(State::RESPAWNING);
}
}
void Player::handleRollingMovement() {
handleRollingBoundaryCollision();
handleRollingGroundCollision();
@@ -465,6 +475,9 @@ void Player::setAnimation() {
player_sprite_->setFlip(flipMode);
break;
}
case State::THANK_YOU:
player_sprite_->setCurrentAnimation("thank_you");
break;
case State::WAITING:
case State::GAME_OVER:
player_sprite_->setCurrentAnimation("hello");
@@ -627,8 +640,11 @@ void Player::setPlayingState(State state) {
playing_state_ = state;
switch (playing_state_) {
case State::RESPAWNING: {
case State::THANK_YOU: {
playSound("voice_thankyou.wav");
break;
}
case State::RESPAWNING: {
setPlayingState(State::PLAYING);
setInvulnerable(true);
break;

View File

@@ -72,7 +72,8 @@ class Player {
CREDITS, // Estado para mostrar los créditos del juego
TITLE_ANIMATION, // Animacion para el titulo
TITLE_HIDDEN, // Animacion para el titulo
RESPAWNING, // Tras continuar y volver al juego
THANK_YOU, // Al aceptar continuar
RESPAWNING, // Tras continuar y dar las gracias, otorga inmunidad y vuelve al juego
};
struct Config {
@@ -280,6 +281,7 @@ class Player {
void transitionToCooling(); // Cambia el estado actual al de enfriamiento (por ejemplo, tras una ráfaga o sobrecalentamiento)
void completeCooling(); // Finaliza el proceso de enfriamiento y restablece el estado listo para disparar
void handlePlayingMovement(); // Gestiona el movimiento del personaje u objeto durante el estado de juego activo
void handleThankYouMovement(); // Comprueba si ha acabado la animación
void handleRollingMovement(); // Actualiza la lógica de movimiento de "rodar" (posiblemente tras impacto o acción especial)
void handleRollingBoundaryCollision(); // Detecta y maneja colisiones del objeto rodante con los límites de la pantalla
void handleRollingGroundCollision(); // Gestiona la interacción del objeto rodante con el suelo (rebotes, frenado, etc.)

View File

@@ -1475,7 +1475,7 @@ void Game::handleFireInputs(const std::shared_ptr<Player> &player, bool autofire
// Maneja la continuación del jugador cuando no está jugando, permitiendo que continúe si se pulsa el botón de inicio.
void Game::handlePlayerContinueInput(const std::shared_ptr<Player> &player) {
if (input_->checkAction(Input::Action::START, Input::DO_NOT_ALLOW_REPEAT, player->getUsesKeyboard(), player->getGamepad())) {
player->setPlayingState(Player::State::RESPAWNING);
player->setPlayingState(Player::State::THANK_YOU);
player->addCredit();
sendPlayerToTheFront(player);
// Crea letrero de THANK_YOU