migrat a deltaTime screen.cpp i notifier.cpp
This commit is contained in:
@@ -282,7 +282,7 @@ void Game::updateStage() {
|
||||
// Efectos de cambio de fase
|
||||
playSound("stage_change.wav");
|
||||
balloon_manager_->resetBalloonSpeed();
|
||||
screen_->flash(Colors::FLASH, 3);
|
||||
screen_->flash(Colors::FLASH, 0.05F);
|
||||
screen_->shake();
|
||||
|
||||
// Obtener datos de la nueva fase
|
||||
@@ -635,7 +635,7 @@ void Game::updateItems(float deltaTime) {
|
||||
item->update(deltaTime);
|
||||
if (item->isOnFloor()) {
|
||||
playSound("title.wav");
|
||||
screen_->shake(1, 2, 4);
|
||||
screen_->shake(1, 0.033f, 0.067f); // desp=1, delay=0.033s, length=0.067s
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -784,7 +784,7 @@ void Game::throwCoffee(int x, int y) {
|
||||
smart_sprites_.back()->setWidth(param.game.item_size);
|
||||
smart_sprites_.back()->setHeight(param.game.item_size);
|
||||
smart_sprites_.back()->setVelX((-1.0F + ((rand() % 5) * 0.5F)) * 60.0f); // Convertir a pixels/segundo
|
||||
smart_sprites_.back()->setVelY(-4.0F * 60.0f); // Convertir a pixels/segundo
|
||||
smart_sprites_.back()->setVelY(-4.0F * 60.0f); // Convertir a pixels/segundo
|
||||
smart_sprites_.back()->setAccelX(0.0F);
|
||||
smart_sprites_.back()->setAccelY(0.2F * 60.0f * 60.0f); // Convertir a pixels/segundo² (0.2 × 60²)
|
||||
smart_sprites_.back()->setDestX(x + (smart_sprites_.back()->getVelX() * 50));
|
||||
@@ -859,9 +859,9 @@ void Game::handlePlayerCollision(std::shared_ptr<Player> &player, std::shared_pt
|
||||
|
||||
// Actualiza el estado del tiempo detenido
|
||||
void Game::updateTimeStopped(float deltaTime) {
|
||||
static constexpr float WARNING_THRESHOLD_S = 2.0f; // 120 frames a 60fps → segundos
|
||||
static constexpr float CLOCK_SOUND_INTERVAL_S = 0.5f; // 30 frames a 60fps → segundos
|
||||
static constexpr float COLOR_FLASH_INTERVAL_S = 0.25f; // 15 frames a 60fps → segundos
|
||||
static constexpr float WARNING_THRESHOLD_S = 2.0f; // 120 frames a 60fps → segundos
|
||||
static constexpr float CLOCK_SOUND_INTERVAL_S = 0.5f; // 30 frames a 60fps → segundos
|
||||
static constexpr float COLOR_FLASH_INTERVAL_S = 0.25f; // 15 frames a 60fps → segundos
|
||||
|
||||
if (time_stopped_timer_ > 0) {
|
||||
time_stopped_timer_ -= deltaTime;
|
||||
@@ -895,7 +895,8 @@ void Game::updateTimeStopped(float deltaTime) {
|
||||
|
||||
// Actualiza toda la lógica del juego
|
||||
void Game::update(float deltaTime) {
|
||||
screen_->update();
|
||||
screen_->update(deltaTime); // Actualiza el objeto screen
|
||||
Audio::update(); // Actualiza el objeto audio
|
||||
|
||||
updateDemo();
|
||||
#ifdef RECORDING
|
||||
@@ -903,8 +904,6 @@ void Game::update(float deltaTime) {
|
||||
#endif
|
||||
updateGameStates(deltaTime);
|
||||
fillCanvas();
|
||||
|
||||
Audio::update();
|
||||
}
|
||||
|
||||
// Dibuja el juego
|
||||
@@ -1735,9 +1734,6 @@ void Game::updateGameStateEnteringPlayer(float deltaTime) {
|
||||
// Actualiza las variables durante dicho estado
|
||||
void Game::updateGameStateShowingGetReadyMessage(float deltaTime) {
|
||||
updateGameStatePlaying(deltaTime);
|
||||
if (path_sprites_.empty()) {
|
||||
setState(State::PLAYING);
|
||||
}
|
||||
|
||||
// Reproducir música después de ~1.67 segundos (100 frames a 60fps)
|
||||
static bool music_started = false;
|
||||
|
||||
Reference in New Issue
Block a user