Afegida una lluna i un sol al fondo

This commit is contained in:
2025-01-05 07:32:30 +01:00
parent 0711c8dada
commit 198aa45d59
6 changed files with 136 additions and 36 deletions

View File

@@ -36,6 +36,7 @@
#include "text.h" // Para Text
#include "texture.h" // Para Texture
#include "mouse.h"
#include "dbgtxt.h"
struct JA_Sound_t; // lines 37-37
// Constructor
@@ -855,8 +856,8 @@ void Game::renderPathSprites()
void Game::killPlayer(std::shared_ptr<Player> &player)
{
if (!player->isPlaying() || player->isInvulnerable())
{
// Si no está jugando o tiene inmunidad, no hace nada
{
// Si no está jugando o tiene inmunidad, no hace nada
return;
}
@@ -969,9 +970,9 @@ void Game::updateBackground()
}
// Calcula la velocidad en función de los globos explotados y el total de globos a explotar para acabar el juego
constexpr float clouds_initial_speed = 0.05f;
constexpr float clouds_final_speed = 2.00f - clouds_initial_speed;
const float cloudsSpeed = (-clouds_initial_speed) + (-clouds_final_speed * (static_cast<float>(Stage::total_power) / total_power_to_complete_game_));
constexpr float CLOUDS_INITIAL_SPEED = 0.05f;
constexpr float CLOUDS_FINAL_SPEED = 2.00f - CLOUDS_INITIAL_SPEED;
const float cloudsSpeed = (-CLOUDS_INITIAL_SPEED) + (-CLOUDS_FINAL_SPEED * (static_cast<float>(Stage::total_power) / total_power_to_complete_game_));
background_->setCloudsSpeed(cloudsSpeed);
// Calcula la transición de los diferentes fondos
@@ -981,6 +982,11 @@ void Game::updateBackground()
background_->setGradientNumber(static_cast<int>(gradient_number));
background_->setTransition(percent);
// Calcula la posición del sol
constexpr float sun_final_power = num * 2;
background_->setSunProgression(Stage::total_power / sun_final_power);
background_->setMoonProgression(Stage::total_power / static_cast<float>(total_power_to_complete_game_));
// Actualiza el objeto
background_->update();
}
@@ -1690,9 +1696,6 @@ void Game::initDemo(int player_id)
// Configura los marcadores
scoreboard_->setMode(SCOREBOARD_LEFT_PANEL, ScoreboardMode::DEMO);
scoreboard_->setMode(SCOREBOARD_RIGHT_PANEL, ScoreboardMode::DEMO);
// Añade unos cuantos globos
// balloon_manager_->createRandomBalloons();
}
// Modo grabar demo
@@ -1931,7 +1934,7 @@ void Game::updateGameStatePlaying()
#ifdef DEBUG
if (auto_pop_balloons_)
{
Stage::addPower(20);
Stage::addPower(5);
}
#endif
updatePlayers();