revisat credits.cpp, player.cpp, balloon.cpp i balloon_manager.cpp

This commit is contained in:
2025-09-23 13:42:09 +02:00
parent 6c8f231b34
commit 159528adc9
34 changed files with 184 additions and 326 deletions

View File

@@ -86,7 +86,7 @@ void BalloonManager::deployRandomFormation(int stage) {
// En este punto se decide entre crear una powerball o una formación enemiga
if ((rand() % 100 < 15) && (canPowerBallBeCreated())) {
createPowerBall(); // Crea una powerball
balloon_deploy_counter_ = -167; // Resetea con pequeño retraso (10 frames = 167ms negativos)
balloon_deploy_counter_ = -10.0f / 60.0f; // Resetea con pequeño retraso (10 frames = ~0.167s negativos)
} else {
// Decrementa el contador de despliegues de globos necesarios para la siguiente PowerBall
if (power_ball_counter_ > 0) {
@@ -164,7 +164,7 @@ void BalloonManager::freeBalloons() {
// Actualiza la variable enemyDeployCounter (time-based)
void BalloonManager::updateBalloonDeployCounter(float deltaTime) {
// DeltaTime puro - contador incrementa hasta llegar al umbral
// DeltaTime en segundos - contador incrementa hasta llegar al umbral
balloon_deploy_counter_ += deltaTime;
}
@@ -216,9 +216,9 @@ void BalloonManager::createChildBalloon(const std::shared_ptr<Balloon> &balloon,
// Crea el globo
auto b = createBalloon(config);
// Establece parametros (deltaTime puro - valores ya en pixels/ms)
constexpr float VEL_Y_BALLOON_PER_MS = -0.15F; // -2.50F convertido a pixels/ms
b->setVelY(b->getType() == Balloon::Type::BALLOON ? VEL_Y_BALLOON_PER_MS : Balloon::VELX_NEGATIVE * 2.0F);
// Establece parametros (deltaTime en segundos - velocidades en pixels/segundo)
constexpr float VEL_Y_BALLOON_PER_S = -9.0F; // -0.15 pixels/ms convertido a pixels/segundo (-0.15 * 60 = -9)
b->setVelY(b->getType() == Balloon::Type::BALLOON ? VEL_Y_BALLOON_PER_S : Balloon::VELX_NEGATIVE * 2.0F);
// Herencia de estados
if (balloon->isStopped()) { b->stop(); }
@@ -280,7 +280,7 @@ auto BalloonManager::popBalloon(const std::shared_ptr<Balloon> &balloon) -> int
balloon->pop(true);
score = destroyAllBalloons();
power_ball_enabled_ = false;
balloon_deploy_counter_ = -334; // Resetea con retraso (20 frames = 334ms negativos)
balloon_deploy_counter_ = -20.0f / 60.0f; // Resetea con retraso (20 frames = ~0.333s negativos)
} else {
score = balloon->getScore();
if (balloon->getSize() != Balloon::Size::SMALL) {
@@ -336,7 +336,7 @@ auto BalloonManager::destroyAllBalloons() -> int {
score += destroyBalloon(balloon);
}
balloon_deploy_counter_ = -5000; // Resetea con retraso grande (300 frames = 5000ms negativos)
balloon_deploy_counter_ = -300.0f / 60.0f; // Resetea con retraso grande (300 frames = 5s negativos)
Screen::get()->flash(Colors::FLASH, 3);
Screen::get()->shake();