Reduit de 60 a 30 segons de temps per a posar el nom
fix: quan se t'acaba el temps per a posar el nom, no posaves nom. ara posa lo que tingues posat
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "scoreboard.h" // Para Scoreboard, ScoreboardMode
|
||||
#include "stage.h" // Para power_can_be_added
|
||||
#include "texture.h" // Para Texture
|
||||
#include "manage_hiscore_table.h" // Para ManageHiScoreTable, HiScoreEntry
|
||||
|
||||
|
||||
// Constructor
|
||||
Player::Player(int id, float x, int y, bool demo, SDL_FRect &play_area, std::vector<std::shared_ptr<Texture>> texture, const std::vector<std::vector<std::string>> &animations)
|
||||
@@ -184,7 +186,7 @@ void Player::move()
|
||||
{
|
||||
player_sprite_->setPosX(std::clamp(X, MIN_X, MAX_X));
|
||||
player_sprite_->setVelX(-player_sprite_->getVelX());
|
||||
playRandomBubbleSound();
|
||||
playJumpingSound();
|
||||
}
|
||||
|
||||
// Si el cadaver toca el suelo rebota y si tiene poca velocidad, se detiene y cambia de estado
|
||||
@@ -199,7 +201,7 @@ void Player::move()
|
||||
pos_y_ = default_pos_y_;
|
||||
player_sprite_->clear();
|
||||
shiftSprite();
|
||||
playRandomBubbleSound();
|
||||
playJumpingSound();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,7 +209,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);
|
||||
playRandomBubbleSound();
|
||||
playJumpingSound();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -546,6 +548,7 @@ void Player::setPlayingState(PlayerState state)
|
||||
showing_name_ticks_ = SDL_GetTicks();
|
||||
setScoreboardMode(ScoreboardMode::SHOW_NAME);
|
||||
Scoreboard::get()->setRecordName(scoreboard_panel_, last_enter_name_);
|
||||
addScoreToScoreBoard();
|
||||
break;
|
||||
}
|
||||
case PlayerState::DYING:
|
||||
@@ -780,7 +783,8 @@ void Player::decEnterNameCounter()
|
||||
enter_name_counter_ = param.game.enter_name_seconds;
|
||||
if (playing_state_ == PlayerState::ENTERING_NAME)
|
||||
{
|
||||
setPlayingState(PlayerState::CONTINUE);
|
||||
last_enter_name_ = getRecordName();
|
||||
setPlayingState(PlayerState::SHOWING_NAME);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -809,9 +813,16 @@ void Player::shiftSprite()
|
||||
}
|
||||
|
||||
// Hace sonar un ruido al azar
|
||||
void Player::playRandomBubbleSound()
|
||||
void Player::playJumpingSound()
|
||||
{
|
||||
// const std::vector<std::string> sounds = {"bubble1.wav", "bubble2.wav", "bubble3.wav", "bubble4.wav"};
|
||||
// Audio::get()->playSound(sounds.at(rand() % sounds.size()));
|
||||
Audio::get()->playSound("jump.wav");
|
||||
}
|
||||
|
||||
// Añade una puntuación a la tabla de records
|
||||
void Player::addScoreToScoreBoard()
|
||||
{
|
||||
const auto entry = HiScoreEntry(trim(getLastEnterName()), getScore(), get1CC());
|
||||
auto manager = std::make_unique<ManageHiScoreTable>(Options::settings.hi_score_table);
|
||||
Options::settings.last_hi_score_entry.at(getId() - 1) = manager->add(entry);
|
||||
manager->saveToFile(Asset::get()->get("score.bin"));
|
||||
}
|
||||
Reference in New Issue
Block a user