712 lines
27 KiB
C++
712 lines
27 KiB
C++
#include "balloon_formations.h"
|
|
#include "balloon.h" // para BALLOON_VELX_NEGATIVE, BALLOON_VELX_POSITIVE
|
|
#include "param.h" // para param
|
|
#include "utils.h" // para ParamGame, Param, Zone, BLOCK
|
|
|
|
// Constructor
|
|
BalloonFormations::BalloonFormations()
|
|
{
|
|
initBalloonFormations();
|
|
initBalloonFormationPools();
|
|
initGameStages();
|
|
}
|
|
|
|
// Inicializa las formaciones enemigas
|
|
void BalloonFormations::initBalloonFormations()
|
|
{
|
|
constexpr int y4 = -BLOCK;
|
|
const int x4_0 = param.game.play_area.rect.x;
|
|
const int x4_100 = param.game.play_area.rect.w - BALLOON_SIZE[3];
|
|
|
|
constexpr int y3 = -BLOCK;
|
|
const int x3_0 = param.game.play_area.rect.x;
|
|
const int x3_100 = param.game.play_area.rect.w - BALLOON_SIZE[2];
|
|
|
|
constexpr int y2 = -BLOCK;
|
|
const int x2_0 = param.game.play_area.rect.x;
|
|
const int x2_100 = param.game.play_area.rect.w - BALLOON_SIZE[1];
|
|
|
|
constexpr int y1 = -BLOCK;
|
|
const int x1_0 = param.game.play_area.rect.x;
|
|
const int x1_50 = param.game.play_area.center_x - (BALLOON_SIZE[0] / 2);
|
|
const int x1_100 = param.game.play_area.rect.w - BALLOON_SIZE[0];
|
|
|
|
// Inicializa a cero las variables
|
|
for (int j = 0; j < NUMBER_OF_BALLOON_FORMATIONS; ++j)
|
|
{
|
|
balloon_formation_[j].number_of_balloons = 0;
|
|
for (int i = 0; i < MAX_NUMBER_OF_BALLOONS_IN_A_FORMATION; ++i)
|
|
{
|
|
balloon_formation_[j].init[i] = BalloonFormationParams();
|
|
}
|
|
}
|
|
|
|
constexpr int CREATION_TIME = 300;
|
|
int inc_x = 0;
|
|
int inc_time = 0;
|
|
int j = 0;
|
|
|
|
// #00 - Dos enemigos BALLOON4 uno a cada extremo
|
|
j = 0;
|
|
balloon_formation_[j].number_of_balloons = 2;
|
|
inc_x = x4_100;
|
|
inc_time = 0;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x4_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y4;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE4;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME + (inc_time * i);
|
|
}
|
|
|
|
// #01 - Dos enemigos BALLOON4 uno a cada cuarto. Ambos van hacia el centro
|
|
j = 1;
|
|
balloon_formation_[j].number_of_balloons = 2;
|
|
inc_x = param.game.play_area.center_x;
|
|
inc_time = 0;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = param.game.play_area.first_quarter_x - (BALLOON_SIZE[3] / 2) + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y4;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE * (((i % 2) * 2) - 1);
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE4;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME + (inc_time * i);
|
|
}
|
|
|
|
// #02 - Cuatro enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro
|
|
j = 2;
|
|
balloon_formation_[j].number_of_balloons = 4;
|
|
inc_x = BALLOON_SIZE[1] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x2_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y2;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE2;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #03 - Cuatro enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro
|
|
j = 3;
|
|
balloon_formation_[j].number_of_balloons = 4;
|
|
inc_x = BALLOON_SIZE[1] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x2_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y2;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE2;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #04 - Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha
|
|
j = 4;
|
|
balloon_formation_[j].number_of_balloons = 3;
|
|
inc_x = BALLOON_SIZE[2] * 2;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #05 - Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda
|
|
j = 5;
|
|
balloon_formation_[j].number_of_balloons = 3;
|
|
inc_x = BALLOON_SIZE[2] * 2;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #06 - Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha
|
|
j = 6;
|
|
balloon_formation_[j].number_of_balloons = 3;
|
|
inc_x = BALLOON_SIZE[2] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #07 - Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda
|
|
j = 7;
|
|
balloon_formation_[j].number_of_balloons = 3;
|
|
inc_x = BALLOON_SIZE[2] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #08 - Seis enemigos BALLOON1. 0, 0, 0, 0, 0, 0. Hacia la derecha
|
|
j = 8;
|
|
balloon_formation_[j].number_of_balloons = 6;
|
|
inc_x = BALLOON_SIZE[0] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y1;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE1;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #09 - Seis enemigos BALLOON1. 100, 100, 100, 100, 100, 100. Hacia la izquierda
|
|
j = 9;
|
|
balloon_formation_[j].number_of_balloons = 6;
|
|
inc_x = BALLOON_SIZE[0] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y1;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE1;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #10 - Tres enemigos BALLOON4 seguidos desde la izquierda
|
|
j = 10;
|
|
balloon_formation_[j].number_of_balloons = 3;
|
|
inc_x = BALLOON_SIZE[3] + 1;
|
|
inc_time = 15;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x4_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y4;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE4;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #11 - Tres enemigos BALLOON4 seguidos desde la derecha
|
|
j = 11;
|
|
balloon_formation_[j].number_of_balloons = 3;
|
|
inc_x = BALLOON_SIZE[3] + 1;
|
|
inc_time = 15;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x4_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y4;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE4;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #12 - Seis enemigos BALLOON2 uno detras del otro. A la izquierda y hacia el centro
|
|
j = 12;
|
|
balloon_formation_[j].number_of_balloons = 6;
|
|
inc_x = BALLOON_SIZE[1] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x2_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y2;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE2;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #13 - Seis enemigos BALLOON2 uno detras del otro. A la derecha y hacia el centro
|
|
j = 13;
|
|
balloon_formation_[j].number_of_balloons = 6;
|
|
inc_x = BALLOON_SIZE[1] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x2_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y2;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE2;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #14 - Cinco enemigos BALLOON3. Hacia la derecha. Separados
|
|
j = 14;
|
|
balloon_formation_[j].number_of_balloons = 5;
|
|
inc_x = BALLOON_SIZE[2] * 2;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #15 - Cinco enemigos BALLOON3. Hacia la izquierda. Separados
|
|
j = 15;
|
|
balloon_formation_[j].number_of_balloons = 5;
|
|
inc_x = BALLOON_SIZE[2] * 2;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #16 - Cinco enemigos BALLOON3. Hacia la derecha. Juntos
|
|
j = 16;
|
|
balloon_formation_[j].number_of_balloons = 5;
|
|
inc_x = BALLOON_SIZE[2] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #17 - Cinco enemigos BALLOON3. Hacia la izquierda. Juntos
|
|
j = 17;
|
|
balloon_formation_[j].number_of_balloons = 5;
|
|
inc_x = BALLOON_SIZE[2] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #18 - Doce enemigos BALLOON1. Hacia la derecha. Juntos
|
|
j = 18;
|
|
balloon_formation_[j].number_of_balloons = 12;
|
|
inc_x = BALLOON_SIZE[0] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y1;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE1;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #19 - Doce enemigos BALLOON1. Hacia la izquierda. Juntos
|
|
j = 19;
|
|
balloon_formation_[j].number_of_balloons = 12;
|
|
inc_x = BALLOON_SIZE[0] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_100 - (i * inc_x);
|
|
balloon_formation_[j].init[i].y = y1;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE1;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME - (inc_time * i);
|
|
}
|
|
|
|
// #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simetricos
|
|
j = 20;
|
|
balloon_formation_[j].number_of_balloons = 4;
|
|
inc_x = BALLOON_SIZE[3] + 1;
|
|
inc_time = 0;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
const int half = balloon_formation_[j].number_of_balloons / 2;
|
|
if (i < half)
|
|
{
|
|
balloon_formation_[j].init[i].x = x4_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
}
|
|
else
|
|
{
|
|
balloon_formation_[j].init[i].x = x4_100 - ((i - half) * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
}
|
|
balloon_formation_[j].init[i].y = y4;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE4;
|
|
balloon_formation_[j].init[i].creation_counter = CREATION_TIME + (inc_time * i);
|
|
}
|
|
|
|
// #21 - Diez enemigos BALLOON2 uno detras del otro. Izquierda/derecha. Simetricos
|
|
j = 21;
|
|
balloon_formation_[j].number_of_balloons = 10;
|
|
inc_x = BALLOON_SIZE[1] + 1;
|
|
inc_time = 3;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
const int half = balloon_formation_[j].number_of_balloons / 2;
|
|
if (i < half)
|
|
{
|
|
balloon_formation_[j].init[i].x = x2_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * i);
|
|
}
|
|
else
|
|
{
|
|
balloon_formation_[j].init[i].x = x2_100 - ((i - half) * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * (i - half));
|
|
}
|
|
balloon_formation_[j].init[i].y = y2;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE2;
|
|
}
|
|
|
|
// #22 - Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simetricos
|
|
j = 22;
|
|
balloon_formation_[j].number_of_balloons = 10;
|
|
inc_x = BALLOON_SIZE[2] * 2;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
const int half = balloon_formation_[j].number_of_balloons / 2;
|
|
if (i < half)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * i);
|
|
}
|
|
else
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_100 - ((i - half) * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * (i - half));
|
|
}
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
}
|
|
|
|
// #23 - Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simetricos
|
|
j = 23;
|
|
balloon_formation_[j].number_of_balloons = 10;
|
|
inc_x = BALLOON_SIZE[2] + 1;
|
|
inc_time = 10;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
const int half = balloon_formation_[j].number_of_balloons / 2;
|
|
if (i < half)
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_0 + (i * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * i);
|
|
}
|
|
else
|
|
{
|
|
balloon_formation_[j].init[i].x = x3_100 - ((i - half) * inc_x);
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * (i - half));
|
|
}
|
|
balloon_formation_[j].init[i].y = y3;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE3;
|
|
}
|
|
|
|
// #24 - Treinta enemigos BALLOON1. Del centro hacia los extremos. Juntos. Simetricos
|
|
j = 24;
|
|
balloon_formation_[j].number_of_balloons = 30;
|
|
inc_time = 5;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
const int half = balloon_formation_[j].number_of_balloons / 2;
|
|
if (i < half)
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_50;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) + (inc_time * i);
|
|
}
|
|
else
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_50;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) + (inc_time * (i - half));
|
|
}
|
|
balloon_formation_[j].init[i].y = y1;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE1;
|
|
}
|
|
|
|
// #25 - Treinta enemigos BALLOON1. Del centro hacia adentro. Juntos. Simetricos
|
|
j = 25;
|
|
balloon_formation_[j].number_of_balloons = 30;
|
|
inc_time = 5;
|
|
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
|
|
{
|
|
const int half = balloon_formation_[j].number_of_balloons / 2;
|
|
if (i < half)
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_50 + 20;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_NEGATIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * i);
|
|
}
|
|
else
|
|
{
|
|
balloon_formation_[j].init[i].x = x1_50 - 20;
|
|
balloon_formation_[j].init[i].vel_x = BALLOON_VELX_POSITIVE;
|
|
balloon_formation_[j].init[i].creation_counter = (CREATION_TIME) - (inc_time * (i - half));
|
|
}
|
|
balloon_formation_[j].init[i].y = y1;
|
|
balloon_formation_[j].init[i].size = BalloonSize::SIZE1;
|
|
}
|
|
|
|
// Crea las mismas formaciones pero con hexagonos a partir de la posición 50 del vector
|
|
for (int k = 0; k < j + 1; k++)
|
|
{
|
|
balloon_formation_[k + 50].number_of_balloons = balloon_formation_[k].number_of_balloons;
|
|
for (int i = 0; i < balloon_formation_[k + 50].number_of_balloons; i++)
|
|
{
|
|
balloon_formation_[k + 50].init[i].x = balloon_formation_[k].init[i].x;
|
|
balloon_formation_[k + 50].init[i].y = balloon_formation_[k].init[i].y;
|
|
balloon_formation_[k + 50].init[i].vel_x = balloon_formation_[k].init[i].vel_x;
|
|
balloon_formation_[k + 50].init[i].creation_counter = balloon_formation_[k].init[i].creation_counter;
|
|
balloon_formation_[k + 50].init[i].size = balloon_formation_[k].init[i].size;
|
|
balloon_formation_[k + 50].init[i].type = BalloonType::FLOATER;
|
|
}
|
|
}
|
|
|
|
// TEST
|
|
balloon_formation_[99].number_of_balloons = 4;
|
|
|
|
balloon_formation_[99].init[0].x = 10;
|
|
balloon_formation_[99].init[0].y = y1;
|
|
balloon_formation_[99].init[0].vel_x = 0;
|
|
balloon_formation_[99].init[0].size = BalloonSize::SIZE1;
|
|
balloon_formation_[99].init[0].creation_counter = 200;
|
|
|
|
balloon_formation_[99].init[1].x = 50;
|
|
balloon_formation_[99].init[1].y = y1;
|
|
balloon_formation_[99].init[1].vel_x = 0;
|
|
balloon_formation_[99].init[1].size = BalloonSize::SIZE2;
|
|
balloon_formation_[99].init[1].creation_counter = 200;
|
|
|
|
balloon_formation_[99].init[2].x = 90;
|
|
balloon_formation_[99].init[2].y = y1;
|
|
balloon_formation_[99].init[2].vel_x = 0;
|
|
balloon_formation_[99].init[2].size = BalloonSize::SIZE3;
|
|
balloon_formation_[99].init[2].creation_counter = 200;
|
|
|
|
balloon_formation_[99].init[3].x = 140;
|
|
balloon_formation_[99].init[3].y = y1;
|
|
balloon_formation_[99].init[3].vel_x = 0;
|
|
balloon_formation_[99].init[3].size = BalloonSize::SIZE4;
|
|
balloon_formation_[99].init[3].creation_counter = 200;
|
|
}
|
|
|
|
// Inicializa los conjuntos de formaciones
|
|
void BalloonFormations::initBalloonFormationPools()
|
|
{
|
|
// EnemyPool #0
|
|
balloon_formation_pool_[0].set[0] = balloon_formation_[0];
|
|
balloon_formation_pool_[0].set[1] = balloon_formation_[1];
|
|
balloon_formation_pool_[0].set[2] = balloon_formation_[2];
|
|
balloon_formation_pool_[0].set[3] = balloon_formation_[3];
|
|
balloon_formation_pool_[0].set[4] = balloon_formation_[4];
|
|
balloon_formation_pool_[0].set[5] = balloon_formation_[5];
|
|
balloon_formation_pool_[0].set[6] = balloon_formation_[6];
|
|
balloon_formation_pool_[0].set[7] = balloon_formation_[7];
|
|
balloon_formation_pool_[0].set[8] = balloon_formation_[8];
|
|
balloon_formation_pool_[0].set[9] = balloon_formation_[9];
|
|
|
|
// EnemyPool #1
|
|
balloon_formation_pool_[1].set[0] = balloon_formation_[10];
|
|
balloon_formation_pool_[1].set[1] = balloon_formation_[11];
|
|
balloon_formation_pool_[1].set[2] = balloon_formation_[12];
|
|
balloon_formation_pool_[1].set[3] = balloon_formation_[13];
|
|
balloon_formation_pool_[1].set[4] = balloon_formation_[14];
|
|
balloon_formation_pool_[1].set[5] = balloon_formation_[15];
|
|
balloon_formation_pool_[1].set[6] = balloon_formation_[16];
|
|
balloon_formation_pool_[1].set[7] = balloon_formation_[17];
|
|
balloon_formation_pool_[1].set[8] = balloon_formation_[18];
|
|
balloon_formation_pool_[1].set[9] = balloon_formation_[19];
|
|
|
|
// EnemyPool #2
|
|
balloon_formation_pool_[2].set[0] = balloon_formation_[0];
|
|
balloon_formation_pool_[2].set[1] = balloon_formation_[1];
|
|
balloon_formation_pool_[2].set[2] = balloon_formation_[2];
|
|
balloon_formation_pool_[2].set[3] = balloon_formation_[3];
|
|
balloon_formation_pool_[2].set[4] = balloon_formation_[4];
|
|
balloon_formation_pool_[2].set[5] = balloon_formation_[55];
|
|
balloon_formation_pool_[2].set[6] = balloon_formation_[56];
|
|
balloon_formation_pool_[2].set[7] = balloon_formation_[57];
|
|
balloon_formation_pool_[2].set[8] = balloon_formation_[58];
|
|
balloon_formation_pool_[2].set[9] = balloon_formation_[59];
|
|
|
|
// EnemyPool #3
|
|
balloon_formation_pool_[3].set[0] = balloon_formation_[50];
|
|
balloon_formation_pool_[3].set[1] = balloon_formation_[51];
|
|
balloon_formation_pool_[3].set[2] = balloon_formation_[52];
|
|
balloon_formation_pool_[3].set[3] = balloon_formation_[53];
|
|
balloon_formation_pool_[3].set[4] = balloon_formation_[54];
|
|
balloon_formation_pool_[3].set[5] = balloon_formation_[5];
|
|
balloon_formation_pool_[3].set[6] = balloon_formation_[6];
|
|
balloon_formation_pool_[3].set[7] = balloon_formation_[7];
|
|
balloon_formation_pool_[3].set[8] = balloon_formation_[8];
|
|
balloon_formation_pool_[3].set[9] = balloon_formation_[9];
|
|
|
|
// EnemyPool #4
|
|
balloon_formation_pool_[4].set[0] = balloon_formation_[60];
|
|
balloon_formation_pool_[4].set[1] = balloon_formation_[61];
|
|
balloon_formation_pool_[4].set[2] = balloon_formation_[62];
|
|
balloon_formation_pool_[4].set[3] = balloon_formation_[63];
|
|
balloon_formation_pool_[4].set[4] = balloon_formation_[64];
|
|
balloon_formation_pool_[4].set[5] = balloon_formation_[65];
|
|
balloon_formation_pool_[4].set[6] = balloon_formation_[66];
|
|
balloon_formation_pool_[4].set[7] = balloon_formation_[67];
|
|
balloon_formation_pool_[4].set[8] = balloon_formation_[68];
|
|
balloon_formation_pool_[4].set[9] = balloon_formation_[69];
|
|
|
|
// EnemyPool #5
|
|
balloon_formation_pool_[5].set[0] = balloon_formation_[10];
|
|
balloon_formation_pool_[5].set[1] = balloon_formation_[61];
|
|
balloon_formation_pool_[5].set[2] = balloon_formation_[12];
|
|
balloon_formation_pool_[5].set[3] = balloon_formation_[63];
|
|
balloon_formation_pool_[5].set[4] = balloon_formation_[14];
|
|
balloon_formation_pool_[5].set[5] = balloon_formation_[65];
|
|
balloon_formation_pool_[5].set[6] = balloon_formation_[16];
|
|
balloon_formation_pool_[5].set[7] = balloon_formation_[67];
|
|
balloon_formation_pool_[5].set[8] = balloon_formation_[18];
|
|
balloon_formation_pool_[5].set[9] = balloon_formation_[69];
|
|
|
|
// EnemyPool #6
|
|
balloon_formation_pool_[6].set[0] = balloon_formation_[60];
|
|
balloon_formation_pool_[6].set[1] = balloon_formation_[11];
|
|
balloon_formation_pool_[6].set[2] = balloon_formation_[62];
|
|
balloon_formation_pool_[6].set[3] = balloon_formation_[13];
|
|
balloon_formation_pool_[6].set[4] = balloon_formation_[64];
|
|
balloon_formation_pool_[6].set[5] = balloon_formation_[15];
|
|
balloon_formation_pool_[6].set[6] = balloon_formation_[66];
|
|
balloon_formation_pool_[6].set[7] = balloon_formation_[17];
|
|
balloon_formation_pool_[6].set[8] = balloon_formation_[68];
|
|
balloon_formation_pool_[6].set[9] = balloon_formation_[19];
|
|
|
|
// EnemyPool #7
|
|
balloon_formation_pool_[7].set[0] = balloon_formation_[20];
|
|
balloon_formation_pool_[7].set[1] = balloon_formation_[21];
|
|
balloon_formation_pool_[7].set[2] = balloon_formation_[22];
|
|
balloon_formation_pool_[7].set[3] = balloon_formation_[23];
|
|
balloon_formation_pool_[7].set[4] = balloon_formation_[24];
|
|
balloon_formation_pool_[7].set[5] = balloon_formation_[65];
|
|
balloon_formation_pool_[7].set[6] = balloon_formation_[66];
|
|
balloon_formation_pool_[7].set[7] = balloon_formation_[67];
|
|
balloon_formation_pool_[7].set[8] = balloon_formation_[68];
|
|
balloon_formation_pool_[7].set[9] = balloon_formation_[69];
|
|
|
|
// EnemyPool #8
|
|
balloon_formation_pool_[8].set[0] = balloon_formation_[70];
|
|
balloon_formation_pool_[8].set[1] = balloon_formation_[71];
|
|
balloon_formation_pool_[8].set[2] = balloon_formation_[72];
|
|
balloon_formation_pool_[8].set[3] = balloon_formation_[73];
|
|
balloon_formation_pool_[8].set[4] = balloon_formation_[74];
|
|
balloon_formation_pool_[8].set[5] = balloon_formation_[15];
|
|
balloon_formation_pool_[8].set[6] = balloon_formation_[16];
|
|
balloon_formation_pool_[8].set[7] = balloon_formation_[17];
|
|
balloon_formation_pool_[8].set[8] = balloon_formation_[18];
|
|
balloon_formation_pool_[8].set[9] = balloon_formation_[19];
|
|
|
|
// EnemyPool #9
|
|
balloon_formation_pool_[9].set[0] = balloon_formation_[20];
|
|
balloon_formation_pool_[9].set[1] = balloon_formation_[21];
|
|
balloon_formation_pool_[9].set[2] = balloon_formation_[22];
|
|
balloon_formation_pool_[9].set[3] = balloon_formation_[23];
|
|
balloon_formation_pool_[9].set[4] = balloon_formation_[24];
|
|
balloon_formation_pool_[9].set[5] = balloon_formation_[70];
|
|
balloon_formation_pool_[9].set[6] = balloon_formation_[71];
|
|
balloon_formation_pool_[9].set[7] = balloon_formation_[72];
|
|
balloon_formation_pool_[9].set[8] = balloon_formation_[73];
|
|
balloon_formation_pool_[9].set[9] = balloon_formation_[74];
|
|
}
|
|
|
|
// Inicializa las fases del juego
|
|
void BalloonFormations::initGameStages()
|
|
{
|
|
// STAGE 1
|
|
stage_[0].number = 1;
|
|
stage_[0].power_to_complete = 200;
|
|
stage_[0].min_menace = 7 + (4 * 1);
|
|
stage_[0].max_menace = 7 + (4 * 3);
|
|
stage_[0].balloon_pool = balloon_formation_pool_[0];
|
|
|
|
// STAGE 2
|
|
stage_[1].number = 2;
|
|
stage_[1].power_to_complete = 300;
|
|
stage_[1].min_menace = 7 + (4 * 2);
|
|
stage_[1].max_menace = 7 + (4 * 4);
|
|
stage_[1].balloon_pool = balloon_formation_pool_[1];
|
|
|
|
// STAGE 3
|
|
stage_[2].number = 3;
|
|
stage_[2].power_to_complete = 600;
|
|
stage_[2].min_menace = 7 + (4 * 3);
|
|
stage_[2].max_menace = 7 + (4 * 5);
|
|
stage_[2].balloon_pool = balloon_formation_pool_[2];
|
|
|
|
// STAGE 4
|
|
stage_[3].number = 4;
|
|
stage_[3].power_to_complete = 600;
|
|
stage_[3].min_menace = 7 + (4 * 3);
|
|
stage_[3].max_menace = 7 + (4 * 5);
|
|
stage_[3].balloon_pool = balloon_formation_pool_[3];
|
|
|
|
// STAGE 5
|
|
stage_[4].number = 5;
|
|
stage_[4].power_to_complete = 600;
|
|
stage_[4].min_menace = 7 + (4 * 4);
|
|
stage_[4].max_menace = 7 + (4 * 6);
|
|
stage_[4].balloon_pool = balloon_formation_pool_[4];
|
|
|
|
// STAGE 6
|
|
stage_[5].number = 6;
|
|
stage_[5].power_to_complete = 600;
|
|
stage_[5].min_menace = 7 + (4 * 4);
|
|
stage_[5].max_menace = 7 + (4 * 6);
|
|
stage_[5].balloon_pool = balloon_formation_pool_[5];
|
|
|
|
// STAGE 7
|
|
stage_[6].number = 7;
|
|
stage_[6].power_to_complete = 650;
|
|
stage_[6].min_menace = 7 + (4 * 5);
|
|
stage_[6].max_menace = 7 + (4 * 7);
|
|
stage_[6].balloon_pool = balloon_formation_pool_[6];
|
|
|
|
// STAGE 8
|
|
stage_[7].number = 8;
|
|
stage_[7].power_to_complete = 750;
|
|
stage_[7].min_menace = 7 + (4 * 5);
|
|
stage_[7].max_menace = 7 + (4 * 7);
|
|
stage_[7].balloon_pool = balloon_formation_pool_[7];
|
|
|
|
// STAGE 9
|
|
stage_[8].number = 9;
|
|
stage_[8].power_to_complete = 850;
|
|
stage_[8].min_menace = 7 + (4 * 6);
|
|
stage_[8].max_menace = 7 + (4 * 8);
|
|
stage_[8].balloon_pool = balloon_formation_pool_[8];
|
|
|
|
// STAGE 10
|
|
stage_[9].number = 10;
|
|
stage_[9].power_to_complete = 950;
|
|
stage_[9].min_menace = 7 + (4 * 7);
|
|
stage_[9].max_menace = 7 + (4 * 10);
|
|
stage_[9].balloon_pool = balloon_formation_pool_[9];
|
|
}
|
|
|
|
// Devuelve una fase
|
|
Stage BalloonFormations::getStage(int index) const { return stage_[index]; } |