Revisant la classe Balloon

This commit is contained in:
2024-10-26 14:13:08 +02:00
parent de2a29b669
commit f750997b34
6 changed files with 104 additions and 256 deletions

View File

@@ -16,20 +16,20 @@ 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_WIDTH_4;
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_WIDTH_3;
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_WIDTH_2;
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_WIDTH_1 / 2);
const int x1_100 = param.game.play_area.rect.w - BALLOON_WIDTH_1;
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)
@@ -67,7 +67,7 @@ void BalloonFormations::initBalloonFormations()
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_WIDTH_4 / 2) + (i * inc_x);
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;
@@ -77,7 +77,7 @@ void BalloonFormations::initBalloonFormations()
// #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_WIDTH_2 + 1;
inc_x = BALLOON_SIZE[1] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -91,7 +91,7 @@ void BalloonFormations::initBalloonFormations()
// #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_WIDTH_2 + 1;
inc_x = BALLOON_SIZE[1] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -105,7 +105,7 @@ void BalloonFormations::initBalloonFormations()
// #04 - Tres enemigos BALLOON3. 0, 25, 50. Hacia la derecha
j = 4;
balloon_formation_[j].number_of_balloons = 3;
inc_x = BALLOON_WIDTH_3 * 2;
inc_x = BALLOON_SIZE[2] * 2;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -119,7 +119,7 @@ void BalloonFormations::initBalloonFormations()
// #05 - Tres enemigos BALLOON3. 50, 75, 100. Hacia la izquierda
j = 5;
balloon_formation_[j].number_of_balloons = 3;
inc_x = BALLOON_WIDTH_3 * 2;
inc_x = BALLOON_SIZE[2] * 2;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -133,7 +133,7 @@ void BalloonFormations::initBalloonFormations()
// #06 - Tres enemigos BALLOON3. 0, 0, 0. Hacia la derecha
j = 6;
balloon_formation_[j].number_of_balloons = 3;
inc_x = BALLOON_WIDTH_3 + 1;
inc_x = BALLOON_SIZE[2] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -147,7 +147,7 @@ void BalloonFormations::initBalloonFormations()
// #07 - Tres enemigos BALLOON3. 100, 100, 100. Hacia la izquierda
j = 7;
balloon_formation_[j].number_of_balloons = 3;
inc_x = BALLOON_WIDTH_3 + 1;
inc_x = BALLOON_SIZE[2] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -161,7 +161,7 @@ void BalloonFormations::initBalloonFormations()
// #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_WIDTH_1 + 1;
inc_x = BALLOON_SIZE[0] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -175,7 +175,7 @@ void BalloonFormations::initBalloonFormations()
// #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_WIDTH_1 + 1;
inc_x = BALLOON_SIZE[0] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -189,7 +189,7 @@ void BalloonFormations::initBalloonFormations()
// #10 - Tres enemigos BALLOON4 seguidos desde la izquierda
j = 10;
balloon_formation_[j].number_of_balloons = 3;
inc_x = BALLOON_WIDTH_4 + 1;
inc_x = BALLOON_SIZE[3] + 1;
inc_time = 15;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -203,7 +203,7 @@ void BalloonFormations::initBalloonFormations()
// #11 - Tres enemigos BALLOON4 seguidos desde la derecha
j = 11;
balloon_formation_[j].number_of_balloons = 3;
inc_x = BALLOON_WIDTH_4 + 1;
inc_x = BALLOON_SIZE[3] + 1;
inc_time = 15;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -217,7 +217,7 @@ void BalloonFormations::initBalloonFormations()
// #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_WIDTH_2 + 1;
inc_x = BALLOON_SIZE[1] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -231,7 +231,7 @@ void BalloonFormations::initBalloonFormations()
// #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_WIDTH_2 + 1;
inc_x = BALLOON_SIZE[1] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -245,7 +245,7 @@ void BalloonFormations::initBalloonFormations()
// #14 - Cinco enemigos BALLOON3. Hacia la derecha. Separados
j = 14;
balloon_formation_[j].number_of_balloons = 5;
inc_x = BALLOON_WIDTH_3 * 2;
inc_x = BALLOON_SIZE[2] * 2;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -259,7 +259,7 @@ void BalloonFormations::initBalloonFormations()
// #15 - Cinco enemigos BALLOON3. Hacia la izquierda. Separados
j = 15;
balloon_formation_[j].number_of_balloons = 5;
inc_x = BALLOON_WIDTH_3 * 2;
inc_x = BALLOON_SIZE[2] * 2;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -273,7 +273,7 @@ void BalloonFormations::initBalloonFormations()
// #16 - Cinco enemigos BALLOON3. Hacia la derecha. Juntos
j = 16;
balloon_formation_[j].number_of_balloons = 5;
inc_x = BALLOON_WIDTH_3 + 1;
inc_x = BALLOON_SIZE[2] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -287,7 +287,7 @@ void BalloonFormations::initBalloonFormations()
// #17 - Cinco enemigos BALLOON3. Hacia la izquierda. Juntos
j = 17;
balloon_formation_[j].number_of_balloons = 5;
inc_x = BALLOON_WIDTH_3 + 1;
inc_x = BALLOON_SIZE[2] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -301,7 +301,7 @@ void BalloonFormations::initBalloonFormations()
// #18 - Doce enemigos BALLOON1. Hacia la derecha. Juntos
j = 18;
balloon_formation_[j].number_of_balloons = 12;
inc_x = BALLOON_WIDTH_1 + 1;
inc_x = BALLOON_SIZE[0] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -315,7 +315,7 @@ void BalloonFormations::initBalloonFormations()
// #19 - Doce enemigos BALLOON1. Hacia la izquierda. Juntos
j = 19;
balloon_formation_[j].number_of_balloons = 12;
inc_x = BALLOON_WIDTH_1 + 1;
inc_x = BALLOON_SIZE[0] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -329,7 +329,7 @@ void BalloonFormations::initBalloonFormations()
// #20 - Dos enemigos BALLOON4 seguidos desde la izquierda/derecha. Simetricos
j = 20;
balloon_formation_[j].number_of_balloons = 4;
inc_x = BALLOON_WIDTH_4 + 1;
inc_x = BALLOON_SIZE[3] + 1;
inc_time = 0;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -352,7 +352,7 @@ void BalloonFormations::initBalloonFormations()
// #21 - Diez enemigos BALLOON2 uno detras del otro. Izquierda/derecha. Simetricos
j = 21;
balloon_formation_[j].number_of_balloons = 10;
inc_x = BALLOON_WIDTH_2 + 1;
inc_x = BALLOON_SIZE[1] + 1;
inc_time = 3;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -376,7 +376,7 @@ void BalloonFormations::initBalloonFormations()
// #22 - Diez enemigos BALLOON3. Hacia la derecha/izquierda. Separados. Simetricos
j = 22;
balloon_formation_[j].number_of_balloons = 10;
inc_x = BALLOON_WIDTH_3 * 2;
inc_x = BALLOON_SIZE[2] * 2;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -400,7 +400,7 @@ void BalloonFormations::initBalloonFormations()
// #23 - Diez enemigos BALLOON3. Hacia la derecha. Juntos. Simetricos
j = 23;
balloon_formation_[j].number_of_balloons = 10;
inc_x = BALLOON_WIDTH_3 + 1;
inc_x = BALLOON_SIZE[2] + 1;
inc_time = 10;
for (int i = 0; i < balloon_formation_[j].number_of_balloons; i++)
{
@@ -478,7 +478,7 @@ void BalloonFormations::initBalloonFormations()
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::HEXAGON;
balloon_formation_[k + 50].init[i].type = BalloonType::FLOATER;
}
}