arreglos en la powerball:
- quan apareix al centro, pot anar cap a l'esquerra o cap a la dreta - ara apareix a la altura que li toca als globos grans - tarda en generarse igual que la resta de globos - rebota igual que els globos grans (com feia abans de canviar les físiques dels globos grans)
This commit is contained in:
@@ -199,8 +199,8 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
|
||||
this->velX = velx;
|
||||
velY = 0;
|
||||
maxVelY = 3.0f;
|
||||
gravity = 0.10f;
|
||||
defaultVelY = 4.95f;
|
||||
gravity = param->balloon4.grav;
|
||||
defaultVelY = param->balloon4.vel;
|
||||
|
||||
// Puntos que da el globo al ser destruido
|
||||
score = 0;
|
||||
|
||||
@@ -882,7 +882,9 @@ void Game::deployEnemyFormation()
|
||||
|
||||
// Evita repetir la ultima formación enemiga desplegada
|
||||
if (set == lastEnemyDeploy)
|
||||
{
|
||||
++set %= 10;
|
||||
}
|
||||
|
||||
lastEnemyDeploy = set;
|
||||
|
||||
@@ -1087,17 +1089,21 @@ int Game::createBalloon(float x, int y, int kind, float velx, float speed, int c
|
||||
// Crea una PowerBall
|
||||
void Game::createPowerBall()
|
||||
{
|
||||
const int posY = PLAY_AREA_TOP;
|
||||
const int values = 6;
|
||||
const int posY = PLAY_AREA_TOP - BLOCK;
|
||||
|
||||
const int left = PLAY_AREA_LEFT;
|
||||
const int center = PLAY_AREA_CENTER_X - (BALLOON_WIDTH_4 / 2);
|
||||
const int right = PLAY_AREA_RIGHT - BALLOON_WIDTH_4;
|
||||
|
||||
const int luck = rand() % 3;
|
||||
const int x[3] = {left, center, right};
|
||||
const float vx[3] = {BALLOON_VELX_POSITIVE, BALLOON_VELX_POSITIVE, BALLOON_VELX_NEGATIVE};
|
||||
const float vpos = BALLOON_VELX_POSITIVE;
|
||||
const float vneg = BALLOON_VELX_NEGATIVE;
|
||||
|
||||
Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], enemySpeed, 100, balloonTextures[4], balloonAnimations[4], param);
|
||||
const int luck = rand() % values;
|
||||
const int x[values] = {left, left, center, center, right, right};
|
||||
const float vx[values] = {vpos, vpos, vpos, vneg, vneg, vneg};
|
||||
|
||||
Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], enemySpeed, 300, balloonTextures[4], balloonAnimations[4], param);
|
||||
balloons.push_back(b);
|
||||
|
||||
powerBallEnabled = true;
|
||||
@@ -1907,11 +1913,6 @@ void Game::update()
|
||||
// Actualiza el contador de ticks
|
||||
ticks = SDL_GetTicks();
|
||||
|
||||
#ifdef DEBUG
|
||||
if (counter == 0)
|
||||
createPowerBall();
|
||||
#endif
|
||||
|
||||
// Actualiza el contador de juego
|
||||
counter++;
|
||||
|
||||
@@ -2639,15 +2640,6 @@ bool Game::allPlayersAreDead()
|
||||
// Comprueba los eventos que hay en cola
|
||||
void Game::checkEvents()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
const Uint8 *keyStates = SDL_GetKeyboardState(nullptr);
|
||||
|
||||
if (keyStates[SDL_SCANCODE_H] != 0)
|
||||
{
|
||||
createItemScoreSprite(param->gameWidth / 2, param->gameWidth / 2, n1000Sprite);
|
||||
}
|
||||
#endif
|
||||
|
||||
while (SDL_PollEvent(eventHandler) != 0)
|
||||
{
|
||||
// Evento de salida de la aplicación
|
||||
@@ -2659,24 +2651,63 @@ void Game::checkEvents()
|
||||
|
||||
else if (eventHandler->type == SDL_WINDOWEVENT)
|
||||
{
|
||||
if (eventHandler->window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||
switch (eventHandler->window.event)
|
||||
{
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
if (!demo.enabled)
|
||||
{
|
||||
pause(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
if (eventHandler->window.event == SDL_WINDOWEVENT_FOCUS_GAINED)
|
||||
{
|
||||
case SDL_WINDOWEVENT_FOCUS_GAINED:
|
||||
pause(false);
|
||||
}
|
||||
break;
|
||||
|
||||
if (eventHandler->window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
|
||||
{
|
||||
case SDL_WINDOWEVENT_SIZE_CHANGED:
|
||||
reloadTextures();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
else if (eventHandler->type == SDL_KEYDOWN)
|
||||
{
|
||||
switch (eventHandler->key.keysym.sym)
|
||||
{
|
||||
case SDLK_h:
|
||||
createItemScoreSprite(param->gameWidth / 2, param->gameWidth / 2, n1000Sprite);
|
||||
break;
|
||||
|
||||
case SDLK_1:
|
||||
createPowerBall();
|
||||
break;
|
||||
|
||||
case SDLK_2:
|
||||
{
|
||||
const int set = 0;
|
||||
const stage_t stage = enemyFormations->getStage(0);
|
||||
const int numEnemies = stage.enemyPool->set[set]->numberOfEnemies;
|
||||
for (int i = 0; i < numEnemies; ++i)
|
||||
{
|
||||
createBalloon(stage.enemyPool->set[set]->init[i].x,
|
||||
stage.enemyPool->set[set]->init[i].y,
|
||||
stage.enemyPool->set[set]->init[i].kind,
|
||||
stage.enemyPool->set[set]->init[i].velX,
|
||||
enemySpeed,
|
||||
stage.enemyPool->set[set]->init[i].creationCounter);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user