nou: musica al completar el joc
This commit is contained in:
@@ -204,8 +204,8 @@ void Game::updateHiScore() {
|
||||
// Si se supera la máxima puntuación
|
||||
if (!hi_score_achieved_) {
|
||||
hi_score_achieved_ = true;
|
||||
playSound("hi_score_achieved.wav"); // Emite un sonido
|
||||
createMessage({paths_.at(8), paths_.at(9)}, Resource::get()->getTexture("game_text_new_record")); // CRea un mensaje
|
||||
playSound("hi_score_achieved.wav"); // Emite un sonido
|
||||
createMessage({paths_.at(8), paths_.at(9)}, Resource::get()->getTexture("game_text_new_record")); // CRea un mensaje
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1037,7 +1037,7 @@ void Game::initPaths() {
|
||||
const int X1 = param.game.play_area.center_x - (W / 2);
|
||||
const int X2 = param.game.play_area.rect.w;
|
||||
const int Y = param.game.play_area.center_y;
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 0.5f);
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 0.5f);
|
||||
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
|
||||
}
|
||||
|
||||
@@ -1049,7 +1049,7 @@ void Game::initPaths() {
|
||||
const int Y1 = param.game.play_area.center_y - (H / 2);
|
||||
const int Y2 = -H;
|
||||
const int X = param.game.play_area.center_x;
|
||||
paths_.emplace_back(createPath(Y0, Y1, PathType::VERTICAL, X, 80, easeOutQuint), 0.5f);
|
||||
paths_.emplace_back(createPath(Y0, Y1, PathType::VERTICAL, X, 80, easeOutQuint), 0.5f);
|
||||
paths_.emplace_back(createPath(Y1, Y2, PathType::VERTICAL, X, 80, easeInQuint), 0);
|
||||
}
|
||||
|
||||
@@ -1061,8 +1061,8 @@ void Game::initPaths() {
|
||||
const int X0 = -W;
|
||||
const int X1 = param.game.play_area.center_x - (W / 2);
|
||||
const int X2 = param.game.play_area.rect.w;
|
||||
const int Y = param.game.play_area.center_y - (H / 2) - 20;
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 7.0F);
|
||||
const int Y = param.game.play_area.center_y - (H / 2);
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 7.0F);
|
||||
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
|
||||
}
|
||||
|
||||
@@ -1074,7 +1074,7 @@ void Game::initPaths() {
|
||||
const int X0 = param.game.play_area.rect.w;
|
||||
const int X1 = param.game.play_area.center_x - (W / 2);
|
||||
const int X2 = -W;
|
||||
const int Y = param.game.play_area.center_y + (H / 2) - 20;
|
||||
const int Y = param.game.play_area.center_y + (H / 2);
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 7.0F);
|
||||
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
|
||||
}
|
||||
@@ -1083,11 +1083,12 @@ void Game::initPaths() {
|
||||
{
|
||||
const auto &texture = Resource::get()->getTexture("game_text_new_record");
|
||||
const auto W = texture->getWidth();
|
||||
const auto H = texture->getHeight();
|
||||
const int X0 = -W;
|
||||
const int X1 = param.game.play_area.center_x - (W / 2);
|
||||
const int X2 = param.game.play_area.rect.w;
|
||||
const int Y = param.game.play_area.first_quarter_y;
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 1.0f);
|
||||
const int Y = param.game.play_area.center_y - (H / 2) - (H * 2);
|
||||
paths_.emplace_back(createPath(X0, X1, PathType::HORIZONTAL, Y, 80, easeOutQuint), 1.0f);
|
||||
paths_.emplace_back(createPath(X1, X2, PathType::HORIZONTAL, Y, 80, easeInQuint), 0);
|
||||
}
|
||||
}
|
||||
@@ -1658,8 +1659,8 @@ void Game::initPlayers(Player::Id player_id) {
|
||||
}
|
||||
|
||||
// Hace sonar la música
|
||||
void Game::playMusic() {
|
||||
Audio::get()->playMusic("playing.ogg");
|
||||
void Game::playMusic(const std::string &music_file, int loop) {
|
||||
Audio::get()->playMusic(music_file, loop);
|
||||
}
|
||||
|
||||
// Pausa la música
|
||||
@@ -1770,7 +1771,7 @@ void Game::updateGameStateShowingGetReadyMessage(float deltaTime) {
|
||||
if (!music_started) {
|
||||
music_timer += deltaTime;
|
||||
if (music_timer >= 1.67f) {
|
||||
playMusic();
|
||||
playMusic("playing.ogg");
|
||||
music_started = true;
|
||||
setState(State::PLAYING);
|
||||
}
|
||||
@@ -1781,7 +1782,7 @@ void Game::updateGameStateShowingGetReadyMessage(float deltaTime) {
|
||||
void Game::updateGameStatePlaying(float deltaTime) {
|
||||
#ifdef _DEBUG
|
||||
if (auto_pop_balloons_) {
|
||||
stage_manager_->addPower(1);
|
||||
stage_manager_->addPower(2);
|
||||
}
|
||||
#endif
|
||||
updatePlayers(deltaTime);
|
||||
@@ -1935,8 +1936,8 @@ void Game::onPauseStateChanged(bool is_paused) {
|
||||
|
||||
// Maneja eventos del juego completado usando flags para triggers únicos
|
||||
void Game::handleGameCompletedEvents() {
|
||||
constexpr float START_CELEBRATIONS_S = 6.667f; // 400 frames a 60fps → segundos
|
||||
constexpr float END_CELEBRATIONS_S = 11.667f; // 700 frames a 60fps → segundos
|
||||
constexpr float START_CELEBRATIONS_S = 6.0f;
|
||||
constexpr float END_CELEBRATIONS_S = 14.0f;
|
||||
|
||||
// Inicio de celebraciones
|
||||
static bool start_celebrations_triggered = false;
|
||||
@@ -1954,6 +1955,7 @@ void Game::handleGameCompletedEvents() {
|
||||
}
|
||||
|
||||
updateHiScore();
|
||||
playMusic("congratulations.ogg", 1);
|
||||
start_celebrations_triggered = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user