Afegida la opció de crear els globos sense temps de creació en el balloon_manager
Modificat el mode demo per a que la primera oleada estiga ja creada
This commit is contained in:
@@ -107,11 +107,18 @@ void BalloonManager::deployBalloonFormation(int stage)
|
||||
last_balloon_deploy_ = formation;
|
||||
|
||||
const auto set = balloon_formations_->getSet(stage, formation);
|
||||
const auto numEnemies = set.number_of_balloons;
|
||||
for (int i = 0; i < numEnemies; ++i)
|
||||
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);
|
||||
createBalloon(
|
||||
p.x,
|
||||
p.y,
|
||||
p.type,
|
||||
p.size,
|
||||
p.vel_x,
|
||||
balloon_speed_,
|
||||
(creation_time_enabled_) ? p.creation_counter : 0);
|
||||
}
|
||||
|
||||
balloon_deploy_counter_ = 300;
|
||||
@@ -123,8 +130,8 @@ void BalloonManager::deployBalloonFormation(int stage)
|
||||
void BalloonManager::deploySet(int set_number)
|
||||
{
|
||||
const auto set = balloon_formations_->getSet(set_number);
|
||||
const auto numEnemies = set.number_of_balloons;
|
||||
for (int i = 0; i < numEnemies; ++i)
|
||||
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);
|
||||
@@ -135,8 +142,8 @@ void BalloonManager::deploySet(int set_number)
|
||||
void BalloonManager::deploySet(int set_number, int y)
|
||||
{
|
||||
const auto set = balloon_formations_->getSet(set_number);
|
||||
const auto numEnemies = set.number_of_balloons;
|
||||
for (int i = 0; i < numEnemies; ++i)
|
||||
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);
|
||||
@@ -366,6 +373,21 @@ void BalloonManager::createTwoBigBalloons()
|
||||
deploySet(1);
|
||||
}
|
||||
|
||||
// Crea una disposición de globos aleatoria
|
||||
void BalloonManager::createRandomBalloons()
|
||||
{
|
||||
const int num_balloons = 2 + rand() % 4;
|
||||
for (int i = 0; i < num_balloons; ++i)
|
||||
{
|
||||
const float x = param.game.game_area.rect.x + (rand() % param.game.game_area.rect.w) - BALLOON_SIZE[3];
|
||||
const int y = param.game.game_area.rect.y + (rand() % 50);
|
||||
const BalloonSize size = static_cast<BalloonSize>(rand() % 4);
|
||||
const float vel_x = (rand() % 2 == 0) ? BALLOON_VELX_POSITIVE : BALLOON_VELX_NEGATIVE;
|
||||
const int creation_counter = 0;
|
||||
createBalloon(x, y, BalloonType::BALLOON, size, vel_x, balloon_speed_, creation_counter);
|
||||
}
|
||||
}
|
||||
|
||||
// Obtiene el nivel de ameza actual generado por los globos
|
||||
int BalloonManager::getMenace()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user