new: en el mode demo es queda el jugador mort en el terreny de joc
This commit is contained in:
@@ -187,13 +187,14 @@ void Player::move()
|
||||
playRandomBubbleSound();
|
||||
}
|
||||
|
||||
// Si el cadaver toca el suelo cambia el estado
|
||||
// Si el cadaver toca el suelo rebota y si tiene poca velocidad, se detiene y cambia de estado
|
||||
if (player_sprite_->getPosY() > play_area_.h - HEIGHT_)
|
||||
{
|
||||
if (player_sprite_->getVelY() < 2.0f)
|
||||
{
|
||||
// Si la velocidad de rebote es baja, termina de rebotar y cambia de estado
|
||||
setPlayingState(PlayerState::DIED);
|
||||
const auto nextPlayerStatus = IsEligibleForHighScore() ? PlayerState::ENTERING_NAME : PlayerState::CONTINUE;
|
||||
demo_ ? setPlayingState(PlayerState::LYING_ON_THE_FLOOR_FOREVER) : setPlayingState(nextPlayerStatus);
|
||||
pos_x_ = player_sprite_->getPosX();
|
||||
pos_y_ = default_pos_y_;
|
||||
player_sprite_->clear();
|
||||
@@ -381,7 +382,7 @@ void Player::setAnimation()
|
||||
player_sprite_->setCurrentAnimation("dying");
|
||||
break;
|
||||
}
|
||||
case PlayerState::DIED:
|
||||
case PlayerState::LYING_ON_THE_FLOOR_FOREVER:
|
||||
case PlayerState::ENTERING_NAME:
|
||||
case PlayerState::CONTINUE:
|
||||
{
|
||||
@@ -544,12 +545,6 @@ void Player::setPlayingState(PlayerState state)
|
||||
(rand() % 2 == 0) ? player_sprite_->setVelX(3.3f) : player_sprite_->setVelX(-3.3f);
|
||||
break;
|
||||
}
|
||||
case PlayerState::DIED:
|
||||
{
|
||||
const auto nextPlayerStatus = IsEligibleForHighScore() ? PlayerState::ENTERING_NAME : PlayerState::CONTINUE;
|
||||
demo_ ? setPlayingState(PlayerState::WAITING) : setPlayingState(nextPlayerStatus);
|
||||
break;
|
||||
}
|
||||
case PlayerState::GAME_OVER:
|
||||
{
|
||||
setScoreboardMode(ScoreboardMode::GAME_OVER);
|
||||
|
||||
@@ -40,7 +40,7 @@ enum class PlayerState
|
||||
ENTERING_NAME, // Introduciendo nombre para la tabla de puntuaciones
|
||||
SHOWING_NAME, // Mostrando el nombre introducido
|
||||
DYING, // El jugador está muriendo (animación de muerte)
|
||||
DIED, // El jugador ha muerto y ha desaparecido
|
||||
LYING_ON_THE_FLOOR_FOREVER, // El jugador está inconsciente para siempre en el suelo (demo)
|
||||
GAME_OVER, // Fin de la partida, no puede jugar
|
||||
CELEBRATING, // Celebrando victoria (pose de victoria)
|
||||
ENTERING_NAME_GAME_COMPLETED, // Introduciendo nombre tras completar el juego
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
int getRecordNamePos() const; // Obtiene la posición que se está editando del nombre del jugador para la tabla de mejores puntuaciones
|
||||
|
||||
// Comprobación de playing_state
|
||||
bool hasDied() const { return playing_state_ == PlayerState::DIED; }
|
||||
bool isLyingOnTheFloorForever() const { return playing_state_ == PlayerState::LYING_ON_THE_FLOOR_FOREVER; }
|
||||
bool isCelebrating() const { return playing_state_ == PlayerState::CELEBRATING; }
|
||||
bool isContinue() const { return playing_state_ == PlayerState::CONTINUE; }
|
||||
bool isDying() const { return playing_state_ == PlayerState::DYING; }
|
||||
|
||||
Reference in New Issue
Block a user