diff --git a/data/gfx/balloon/balloon1.ani b/data/gfx/balloon/balloon1.ani index aa701fe..57cd439 100644 --- a/data/gfx/balloon/balloon1.ani +++ b/data/gfx/balloon/balloon1.ani @@ -1,5 +1,5 @@ -frame_width=10 -frame_height=10 +frame_width=16 +frame_height=16 [animation] name=orange diff --git a/data/gfx/balloon/balloon2.ani b/data/gfx/balloon/balloon2.ani index 57cd439..9085bde 100644 --- a/data/gfx/balloon/balloon2.ani +++ b/data/gfx/balloon/balloon2.ani @@ -1,5 +1,5 @@ -frame_width=16 -frame_height=16 +frame_width=26 +frame_height=26 [animation] name=orange diff --git a/data/gfx/balloon/balloon3.ani b/data/gfx/balloon/balloon3.ani index 9085bde..32220b3 100644 --- a/data/gfx/balloon/balloon3.ani +++ b/data/gfx/balloon/balloon3.ani @@ -1,5 +1,5 @@ -frame_width=26 -frame_height=26 +frame_width=48 +frame_height=48 [animation] name=orange diff --git a/data/gfx/balloon/explosion1.ani b/data/gfx/balloon/explosion1.ani index 7206e11..e62469e 100644 --- a/data/gfx/balloon/explosion1.ani +++ b/data/gfx/balloon/explosion1.ani @@ -1,5 +1,5 @@ -frame_width=10 -frame_height=10 +frame_width=16 +frame_height=16 [animation] name=default diff --git a/data/gfx/balloon/explosion2.ani b/data/gfx/balloon/explosion2.ani index e62469e..feb66e3 100644 --- a/data/gfx/balloon/explosion2.ani +++ b/data/gfx/balloon/explosion2.ani @@ -1,5 +1,5 @@ -frame_width=16 -frame_height=16 +frame_width=26 +frame_height=26 [animation] name=default diff --git a/source/balloon.h b/source/balloon.h index c3ca2f2..50c2a0f 100644 --- a/source/balloon.h +++ b/source/balloon.h @@ -32,10 +32,6 @@ class Balloon { static constexpr float VELX_POSITIVE = 0.7F; static constexpr float VELX_NEGATIVE = -0.7F; - static constexpr int MOVING_ANIMATION = 0; - static constexpr int POP_ANIMATION = 1; - static constexpr int BORN_ANIMATION = 2; - static constexpr std::array SPEED = {0.60F, 0.70F, 0.80F, 0.90F, 1.00F}; static constexpr int POWERBALL_SCREENPOWER_MINIMUM = 10; diff --git a/source/balloon_manager.cpp b/source/balloon_manager.cpp index 4f0e7b5..0bca108 100644 --- a/source/balloon_manager.cpp +++ b/source/balloon_manager.cpp @@ -22,6 +22,12 @@ BalloonManager::BalloonManager() // Inicializa void BalloonManager::init() { + // Limpia + balloon_textures_.clear(); + balloon_animations_.clear(); + explosions_textures_.clear(); + explosions_animations_.clear(); + // Texturas - Globos balloon_textures_.emplace_back(Resource::get()->getTexture("balloon0.png")); balloon_textures_.emplace_back(Resource::get()->getTexture("balloon1.png")); @@ -49,10 +55,10 @@ void BalloonManager::init() { explosions_animations_.emplace_back(Resource::get()->getAnimation("explosion3.ani")); // AƱade texturas - explosions_->addTexture(0, explosions_textures_[0], explosions_animations_[0]); - explosions_->addTexture(1, explosions_textures_[1], explosions_animations_[1]); - explosions_->addTexture(2, explosions_textures_[2], explosions_animations_[2]); - explosions_->addTexture(3, explosions_textures_[3], explosions_animations_[3]); + explosions_->addTexture(0, explosions_textures_.at(0), explosions_animations_.at(0)); + explosions_->addTexture(1, explosions_textures_.at(1), explosions_animations_.at(1)); + explosions_->addTexture(2, explosions_textures_.at(2), explosions_animations_.at(2)); + explosions_->addTexture(3, explosions_textures_.at(3), explosions_animations_.at(3)); } // Actualiza @@ -121,8 +127,8 @@ void BalloonManager::deploySet(int set_number) { const auto SET = balloon_formations_->getSet(set_number); const auto NUM_ENEMIES = SET.number_of_balloons; for (int i = 0; i < NUM_ENEMIES; ++i) { - auto p = SET.init[i]; - createBalloon(p.x, p.y, p.type, p.size, p.vel_x, balloon_speed_, p.creation_counter); + auto balloon = SET.init[i]; + createBalloon(balloon.x, balloon.y, balloon.type, balloon.size, balloon.vel_x, balloon_speed_, balloon.creation_counter); } } @@ -131,8 +137,8 @@ void BalloonManager::deploySet(int set_number, int y) { const auto SET = balloon_formations_->getSet(set_number); const auto NUM_ENEMIES = SET.number_of_balloons; for (int i = 0; i < NUM_ENEMIES; ++i) { - auto p = SET.init[i]; - createBalloon(p.x, y, p.type, p.size, p.vel_x, balloon_speed_, p.creation_counter); + auto balloon = SET.init[i]; + createBalloon(balloon.x, y, balloon.type, balloon.size, balloon.vel_x, balloon_speed_, balloon.creation_counter); } } diff --git a/source/color.h b/source/color.h index 0411c0f..a742dc5 100644 --- a/source/color.h +++ b/source/color.h @@ -1,7 +1,7 @@ +// IWYU pragma: no_include #pragma once #include // Para Uint8 -#include // Para abs #include // Para max, min #include // Para array diff --git a/source/sections/game.cpp b/source/sections/game.cpp index e7f0ec5..970ff1c 100644 --- a/source/sections/game.cpp +++ b/source/sections/game.cpp @@ -1768,9 +1768,11 @@ void Game::checkAndUpdateBalloonSpeed() { constexpr std::array THRESHOLDS = {0.2F, 0.4F, 0.6F, 0.8F}; for (size_t i = 0; i < std::size(THRESHOLDS); ++i) { - if (balloon_manager_->getBalloonSpeed() == Balloon::SPEED.at(i) && PERCENT > THRESHOLDS[i]) { + // Si la velocidad actual del globo es la correspondiente al umbral "i" y el porcentaje de progreso ha superado ese umbral + if (balloon_manager_->getBalloonSpeed() == Balloon::SPEED.at(i) && PERCENT > THRESHOLDS.at(i)) { + // Sube la velocidad al siguiente nivel (i + 1) balloon_manager_->setBalloonSpeed(Balloon::SPEED.at(i + 1)); - break; // Salir del bucle una vez actualizada la velocidad y aplicada + return; } } }