fix: arreglats mil mini bugs d'estes ultimes coses que he estat fent. El cas es que el joc es veu igual pero porte dos matins aci fent el mongol.

This commit is contained in:
2025-07-24 16:25:09 +02:00
parent 1233b27eb6
commit 91730def9a
11 changed files with 61 additions and 46 deletions

View File

@@ -78,42 +78,44 @@ void BalloonManager::render() {
explosions_->render();
}
// Crea una formación de enemigos
void BalloonManager::deployBalloonFormation(int stage) {
// Crea una formación de globos
void BalloonManager::deployRandomFormation(int stage) {
// Solo despliega una formación enemiga si ha pasado cierto tiempo desde la última
if (balloon_deploy_counter_ == 0) {
// En este punto se decide entre crear una powerball o una formación enemiga
if ((rand() % 100 < 15) && (canPowerBallBeCreated())) {
// Crea una powerball
createPowerBall();
// Da un poco de margen para que se creen mas enemigos
balloon_deploy_counter_ = 10;
createPowerBall(); // Crea una powerball
balloon_deploy_counter_ = 10; // Da un poco de margen para que se creen mas globos
} else {
// Decrementa el contador de despliegues enemigos de la PowerBall
power_ball_counter_ = (power_ball_counter_ > 0) ? (power_ball_counter_ - 1) : 0;
// Decrementa el contador de despliegues de globos necesarios para la siguiente PowerBall
if (power_ball_counter_ > 0) {
--power_ball_counter_;
}
// Elige una formación enemiga la azar
auto formation_id = rand() % 10;
const auto NUM_FORMATIONS = balloon_formations_->getPoolSize(stage);
int formation_id = rand() % NUM_FORMATIONS;
// Evita repetir la ultima formación enemiga desplegada
if (formation_id == last_balloon_deploy_) {
++formation_id %= 10;
++formation_id %= NUM_FORMATIONS;
}
last_balloon_deploy_ = formation_id;
// Crea los globos de la formación
const auto BALLOONS = balloon_formations_->getFormationFromPool(stage, formation_id).balloons;
for (auto balloon : BALLOONS) {
createBalloon(balloon.x, balloon.y, balloon.type, balloon.size, balloon.vel_x, balloon_speed_, (creation_time_enabled_) ? balloon.creation_counter : 0);
}
// Reinicia el contador para el próximo despliegue
balloon_deploy_counter_ = 300;
}
}
}
// Crea una formación de enemigos específica
// Crea una formación de globos específica
void BalloonManager::deployFormation(int formation_id) {
const auto BALLOONS = balloon_formations_->getFormation(formation_id).balloons;
for (auto balloon : BALLOONS) {
@@ -121,7 +123,7 @@ void BalloonManager::deployFormation(int formation_id) {
}
}
// Crea una formación de enemigos específica a una altura determinada
// Crea una formación de globos específica a una altura determinada
void BalloonManager::deployFormation(int formation_id, int y) {
const auto BALLOONS = balloon_formations_->getFormation(formation_id).balloons;
for (auto balloon : BALLOONS) {