modificada la classe balloon: eliminat el estat popping i dibuixat desde fitxers gif, pero no funciona el canvi de paleta
This commit is contained in:
9
data/gfx/powerball.ani
Normal file
9
data/gfx/powerball.ani
Normal file
@@ -0,0 +1,9 @@
|
||||
frameWidth=46
|
||||
frameHeight=46
|
||||
|
||||
[animation]
|
||||
name=default
|
||||
speed=10
|
||||
loop=-1
|
||||
frames=0
|
||||
[/animation]
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 536 B After Width: | Height: | Size: 1.1 KiB |
@@ -256,7 +256,6 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
|
||||
beingCreated = true;
|
||||
creationCounter = creationtimer;
|
||||
creationCounterIni = creationtimer;
|
||||
popping = false;
|
||||
|
||||
// Actualiza valores
|
||||
beingCreated = creationCounter == 0 ? false : true;
|
||||
@@ -318,28 +317,23 @@ void Balloon::render()
|
||||
else if (isBeingCreated())
|
||||
{
|
||||
// Aplica alpha blending
|
||||
//sprite->getTexture()->setPalette(1);
|
||||
sprite->getTexture()->setAlpha(255 - (int)((float)creationCounter * (255.0f / (float)creationCounterIni)));
|
||||
sprite->render();
|
||||
if (kind == POWER_BALL)
|
||||
{
|
||||
Sprite *sp = new Sprite(sprite->getRect(), sprite->getTexture());
|
||||
sp->setSpriteClip(407, 0, 37, 37);
|
||||
sp->render();
|
||||
delete sp;
|
||||
}
|
||||
sprite->getTexture()->setAlpha(255);
|
||||
}
|
||||
else
|
||||
{
|
||||
//sprite->getTexture()->setPalette(0);
|
||||
sprite->render();
|
||||
}
|
||||
|
||||
if (kind == POWER_BALL and !popping)
|
||||
{
|
||||
Sprite *sp = new Sprite(sprite->getRect(), sprite->getTexture());
|
||||
sp->setSpriteClip(407, 0, 37, 37);
|
||||
sp->render();
|
||||
delete sp;
|
||||
}
|
||||
if (kind == POWER_BALL)
|
||||
{
|
||||
Sprite *sp = new Sprite(sprite->getRect(), sprite->getTexture());
|
||||
sp->setSpriteClip(BALLOON_WIDTH_4, 0, BALLOON_WIDTH_4, BALLOON_WIDTH_4);
|
||||
sp->render();
|
||||
delete sp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -458,7 +452,6 @@ void Balloon::disable()
|
||||
kind = 0;
|
||||
maxVelY = 0.0f;
|
||||
menace = 0;
|
||||
popping = false;
|
||||
posX = 0.0f;
|
||||
posY = 0.0f;
|
||||
power = 0;
|
||||
@@ -478,12 +471,7 @@ void Balloon::disable()
|
||||
// Explosiona el globo
|
||||
void Balloon::pop()
|
||||
{
|
||||
setPopping(true);
|
||||
sprite->disableRotate();
|
||||
setStop(true);
|
||||
setStoppedTimer(2000);
|
||||
setInvulnerable(true);
|
||||
menace = 0;
|
||||
disable();
|
||||
}
|
||||
|
||||
// Actualiza al globo a su posicion, animación y controla los contadores
|
||||
@@ -504,17 +492,6 @@ void Balloon::update()
|
||||
// Actualiza los estados del globo
|
||||
void Balloon::updateState()
|
||||
{
|
||||
// Si está explotando
|
||||
if (isPopping())
|
||||
{
|
||||
setInvulnerable(true);
|
||||
setStop(true);
|
||||
if (sprite->animationIsCompleted())
|
||||
{
|
||||
disable();
|
||||
}
|
||||
}
|
||||
|
||||
// Si se está creando
|
||||
if (isBeingCreated())
|
||||
{
|
||||
@@ -577,8 +554,8 @@ void Balloon::updateState()
|
||||
stoppedCounter--;
|
||||
}
|
||||
// Si el contador ha llegado a cero
|
||||
else if (!isPopping())
|
||||
{ // Quitarles el estado "detenido" si no estan explosionando
|
||||
else
|
||||
{ // Quitarles el estado "detenido"
|
||||
setStop(false);
|
||||
|
||||
// Si es una powerball vuelve a rodar
|
||||
@@ -593,26 +570,22 @@ void Balloon::updateState()
|
||||
// Establece la animación correspondiente al estado
|
||||
void Balloon::updateAnimation()
|
||||
{
|
||||
std::string creatingAnimation = "blue";
|
||||
std::string normalAnimation = "orange";
|
||||
std::string creatingAnimation = "stopped";
|
||||
std::string normalAnimation = "normal";
|
||||
|
||||
if (kind == POWER_BALL)
|
||||
{
|
||||
creatingAnimation = "powerball";
|
||||
normalAnimation = "powerball";
|
||||
creatingAnimation = "default";
|
||||
normalAnimation = "default";
|
||||
}
|
||||
else if (getClass() == HEXAGON_CLASS)
|
||||
{
|
||||
creatingAnimation = "red";
|
||||
normalAnimation = "green";
|
||||
creatingAnimation = "stopped";
|
||||
normalAnimation = "normal";
|
||||
}
|
||||
|
||||
// Establece el frame de animación
|
||||
if (isPopping())
|
||||
{
|
||||
sprite->setCurrentAnimation("pop");
|
||||
}
|
||||
else if (isBeingCreated())
|
||||
if (isBeingCreated())
|
||||
{
|
||||
sprite->setCurrentAnimation(creatingAnimation);
|
||||
}
|
||||
@@ -760,18 +733,6 @@ bool Balloon::isBeingCreated()
|
||||
return beingCreated;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Balloon::setPopping(bool value)
|
||||
{
|
||||
popping = value;
|
||||
}
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
bool Balloon::isPopping()
|
||||
{
|
||||
return popping;
|
||||
}
|
||||
|
||||
// Establece el valor de la variable
|
||||
void Balloon::setStoppedTimer(Uint16 time)
|
||||
{
|
||||
@@ -866,11 +827,11 @@ void Balloon::updateBounce()
|
||||
// Indica si el globo se puede explotar
|
||||
bool Balloon::canBePopped()
|
||||
{
|
||||
return isEnabled() && !isPopping() && !isBeingCreated();
|
||||
return isEnabled() && !isBeingCreated();
|
||||
}
|
||||
|
||||
// Indica si el globo se puede destruir
|
||||
bool Balloon::canBeDestroyed()
|
||||
{
|
||||
return isEnabled() && !isPopping();
|
||||
return isEnabled();
|
||||
}
|
||||
@@ -100,7 +100,6 @@ private:
|
||||
bool blinking; // Indica si el globo está intermitente
|
||||
bool enabled; // Indica si el globo esta activo
|
||||
bool invulnerable; // Indica si el globo es invulnerable
|
||||
bool popping; // Indica si el globo está explotando
|
||||
bool stopped; // Indica si el globo está parado
|
||||
bool visible; // Indica si el globo es visible
|
||||
circle_t collider; // Circulo de colisión del objeto
|
||||
@@ -223,12 +222,6 @@ public:
|
||||
// Obtiene del valor de la variable
|
||||
bool isBeingCreated();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setPopping(bool value);
|
||||
|
||||
// Obtiene del valor de la variable
|
||||
bool isPopping();
|
||||
|
||||
// Establece el valor de la variable
|
||||
void setStoppedTimer(Uint16 time);
|
||||
|
||||
|
||||
@@ -321,25 +321,26 @@ bool Director::setFileList()
|
||||
|
||||
// Texturas
|
||||
asset->add(prefix + "/data/gfx/balloon1.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon1.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon1.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon2.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon2.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon2.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon3.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon3.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon3.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon4.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon4.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon4.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon1_explosion.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon1_explosion.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon1_explosion.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon2_explosion.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon2_explosion.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon2_explosion.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon3_explosion.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon3_explosion.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon3_explosion.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon4_explosion.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon4_explosion.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/balloon_blue_pal.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon_yellow_pal.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon_green_pal.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/balloon4_explosion.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/balloon_blue_pal.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/balloon_yellow_pal.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/balloon_green_pal.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/powerball.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/powerball.ani", t_animation);
|
||||
|
||||
asset->add(prefix + "/data/gfx/bullet.png", t_bitmap);
|
||||
|
||||
@@ -359,41 +360,41 @@ bool Director::setFileList()
|
||||
asset->add(prefix + "/data/gfx/menu_game_over_end.png", t_bitmap);
|
||||
|
||||
asset->add(prefix + "/data/gfx/item_points1_disk.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/item_points1_disk.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/item_points1_disk.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/item_points2_gavina.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/item_points2_gavina.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/item_points2_gavina.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/item_points3_pacmar.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/item_points3_pacmar.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/item_points3_pacmar.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/item_clock.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/item_clock.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/item_clock.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/item_coffee.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/item_coffee.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/item_coffee.ani", t_animation);
|
||||
asset->add(prefix + "/data/gfx/item_coffee_machine.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/item_coffee_machine.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/item_coffee_machine.ani", t_animation);
|
||||
|
||||
asset->add(prefix + "/data/gfx/title_bg_tile.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/title_coffee.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/title_crisis.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/title_arcade_edition.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/title_dust.png", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/title_dust.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/title_dust.ani", t_animation);
|
||||
|
||||
asset->add(prefix + "/data/gfx/player1.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player1_pal1.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player1_pal2.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player1_pal3.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player1_pal1.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/player1_pal2.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/player1_pal3.gif", t_palette);
|
||||
|
||||
asset->add(prefix + "/data/gfx/player2.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player2_pal1.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player2_pal2.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player2_pal3.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player2_pal1.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/player2_pal2.gif", t_palette);
|
||||
asset->add(prefix + "/data/gfx/player2_pal3.gif", t_palette);
|
||||
|
||||
asset->add(prefix + "/data/gfx/player.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/player.ani", t_animation);
|
||||
|
||||
asset->add(prefix + "/data/gfx/player1_power.gif", t_bitmap);
|
||||
asset->add(prefix + "/data/gfx/player2_power.gif", t_bitmap);
|
||||
|
||||
asset->add(prefix + "/data/gfx/player_power.ani", t_data);
|
||||
asset->add(prefix + "/data/gfx/player_power.ani", t_animation);
|
||||
|
||||
// Fuentes de texto
|
||||
asset->add(prefix + "/data/font/8bithud.png", t_font);
|
||||
@@ -407,7 +408,7 @@ bool Director::setFileList()
|
||||
asset->add(prefix + "/data/font/smb2_big.png", t_font);
|
||||
asset->add(prefix + "/data/font/smb2_big.txt", t_font);
|
||||
asset->add(prefix + "/data/font/smb2.gif", t_font);
|
||||
asset->add(prefix + "/data/font/smb2_pal1.gif", t_font);
|
||||
asset->add(prefix + "/data/font/smb2_pal1.gif", t_palette);
|
||||
asset->add(prefix + "/data/font/smb2.txt", t_font);
|
||||
|
||||
// Textos
|
||||
|
||||
158
source/game.cpp
158
source/game.cpp
@@ -360,6 +360,9 @@ void Game::loadMedia()
|
||||
balloon4Texture->addPalette(asset->get("balloon_green_pal.gif"));
|
||||
balloonTextures.push_back(balloon4Texture);
|
||||
|
||||
Texture *balloon5Texture = new Texture(renderer, asset->get("powerball.png"));
|
||||
balloonTextures.push_back(balloon5Texture);
|
||||
|
||||
// Texturas - Explosiones
|
||||
Texture *explosion1Texture = new Texture(renderer, asset->get("balloon1_explosion.png"));
|
||||
explosionsTextures.push_back(explosion1Texture);
|
||||
@@ -417,30 +420,38 @@ void Game::loadMedia()
|
||||
playerTextures.push_back(player2Textures);
|
||||
|
||||
// Animaciones -- Jugador
|
||||
std::vector<std::string> *playerAnimation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("player.ani"), playerAnimation);
|
||||
playerAnimations.push_back(playerAnimation);
|
||||
{
|
||||
std::vector<std::string> *playerAnimation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("player.ani"), playerAnimation);
|
||||
playerAnimations.push_back(playerAnimation);
|
||||
|
||||
std::vector<std::string> *playerPowerAnimation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("player_power.ani"), playerPowerAnimation);
|
||||
playerAnimations.push_back(playerPowerAnimation);
|
||||
std::vector<std::string> *playerPowerAnimation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("player_power.ani"), playerPowerAnimation);
|
||||
playerAnimations.push_back(playerPowerAnimation);
|
||||
}
|
||||
|
||||
// Animaciones -- Globos
|
||||
std::vector<std::string> *balloon1Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon1.ani"), balloon1Animation);
|
||||
balloonAnimations.push_back(balloon1Animation);
|
||||
{
|
||||
std::vector<std::string> *balloon1Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon1.ani"), balloon1Animation);
|
||||
balloonAnimations.push_back(balloon1Animation);
|
||||
|
||||
std::vector<std::string> *balloon2Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon2.ani"), balloon2Animation);
|
||||
balloonAnimations.push_back(balloon2Animation);
|
||||
std::vector<std::string> *balloon2Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon2.ani"), balloon2Animation);
|
||||
balloonAnimations.push_back(balloon2Animation);
|
||||
|
||||
std::vector<std::string> *balloon3Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon3.ani"), balloon3Animation);
|
||||
balloonAnimations.push_back(balloon3Animation);
|
||||
std::vector<std::string> *balloon3Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon3.ani"), balloon3Animation);
|
||||
balloonAnimations.push_back(balloon3Animation);
|
||||
|
||||
std::vector<std::string> *balloon4Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon4.ani"), balloon4Animation);
|
||||
balloonAnimations.push_back(balloon4Animation);
|
||||
std::vector<std::string> *balloon4Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("balloon4.ani"), balloon4Animation);
|
||||
balloonAnimations.push_back(balloon4Animation);
|
||||
|
||||
std::vector<std::string> *balloon5Animation = new std::vector<std::string>;
|
||||
loadAnimations(asset->get("powerball.ani"), balloon5Animation);
|
||||
balloonAnimations.push_back(balloon5Animation);
|
||||
}
|
||||
|
||||
// Animaciones -- Explosiones
|
||||
std::vector<std::string> *explosions1Animation = new std::vector<std::string>;
|
||||
@@ -1805,7 +1816,7 @@ void Game::createPowerBall()
|
||||
const int x[3] = {left, center, right};
|
||||
const float vx[3] = {BALLOON_VELX_POSITIVE, BALLOON_VELX_POSITIVE, BALLOON_VELX_NEGATIVE};
|
||||
|
||||
Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], enemySpeed, 100, balloonTextures[3], balloonAnimations[3], renderer);
|
||||
Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], enemySpeed, 100, balloonTextures[4], balloonAnimations[4], renderer);
|
||||
balloons.push_back(b);
|
||||
|
||||
powerBallEnabled = true;
|
||||
@@ -1929,51 +1940,48 @@ void Game::popBalloon(Balloon *balloon)
|
||||
balloonsPopped++;
|
||||
|
||||
const int kind = balloon->getKind();
|
||||
switch (kind)
|
||||
if (kind == POWER_BALL)
|
||||
{
|
||||
// Si es del tipo más pequeño, simplemente elimina el globo
|
||||
case BALLOON_1:
|
||||
balloon->pop();
|
||||
break;
|
||||
|
||||
case HEXAGON_1:
|
||||
balloon->pop();
|
||||
break;
|
||||
|
||||
// Si es del tipo PowerBall, destruye todos los globos
|
||||
case POWER_BALL:
|
||||
destroyAllBalloons();
|
||||
powerBallEnabled = false;
|
||||
enemyDeployCounter = 20;
|
||||
break;
|
||||
|
||||
// En cualquier otro caso, crea dos globos de un tipo inferior
|
||||
default:
|
||||
const int index = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0);
|
||||
balloons[index]->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
|
||||
if (balloons[index]->getClass() == BALLOON_CLASS)
|
||||
{
|
||||
balloons[index]->setVelY(-2.50f);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int size = balloon->getSize();
|
||||
if (size == BALLOON_SIZE_1)
|
||||
{ // Si es del tipo más pequeño, simplemente elimina el globo
|
||||
explosions->add(balloon->getPosX(), balloon->getPosY(), size);
|
||||
balloon->pop();
|
||||
}
|
||||
else
|
||||
{
|
||||
balloons[index]->setVelY(BALLOON_VELX_NEGATIVE);
|
||||
}
|
||||
{ // En cualquier otro caso, crea dos globos de un tipo inferior
|
||||
const int index = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_NEGATIVE, enemySpeed, 0);
|
||||
balloons[index]->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
|
||||
if (balloons[index]->getClass() == BALLOON_CLASS)
|
||||
{
|
||||
balloons[index]->setVelY(-2.50f);
|
||||
}
|
||||
else
|
||||
{
|
||||
balloons[index]->setVelY(BALLOON_VELX_NEGATIVE);
|
||||
}
|
||||
|
||||
const int index2 = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0);
|
||||
balloons[index2]->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
|
||||
if (balloons[index2]->getClass() == BALLOON_CLASS)
|
||||
{
|
||||
balloons[index2]->setVelY(-2.50f);
|
||||
}
|
||||
else
|
||||
{
|
||||
balloons[index2]->setVelY(BALLOON_VELX_NEGATIVE);
|
||||
}
|
||||
const int index2 = createBalloon(0, balloon->getPosY(), balloon->getKind() - 1, BALLOON_VELX_POSITIVE, enemySpeed, 0);
|
||||
balloons[index2]->allignTo(balloon->getPosX() + (balloon->getWidth() / 2));
|
||||
if (balloons[index2]->getClass() == BALLOON_CLASS)
|
||||
{
|
||||
balloons[index2]->setVelY(-2.50f);
|
||||
}
|
||||
else
|
||||
{
|
||||
balloons[index2]->setVelY(BALLOON_VELX_NEGATIVE);
|
||||
}
|
||||
|
||||
// Elimina el globo
|
||||
balloon->pop();
|
||||
break;
|
||||
// Elimina el globo
|
||||
explosions->add(balloon->getPosX(), balloon->getPosY(), size);
|
||||
balloon->pop();
|
||||
}
|
||||
}
|
||||
|
||||
// Recalcula el nivel de amenaza
|
||||
@@ -1986,7 +1994,8 @@ void Game::destroyBalloon(Balloon *balloon)
|
||||
int score = 0;
|
||||
|
||||
// Calcula la puntuación y el poder que generaria el globo en caso de romperlo a él y a sus hijos
|
||||
switch (balloon->getSize())
|
||||
const int size = balloon->getSize();
|
||||
switch (size)
|
||||
{
|
||||
case BALLOON_SIZE_4:
|
||||
score = BALLOON_SCORE_4 + (2 * BALLOON_SCORE_3) + (4 * BALLOON_SCORE_2) + (8 * BALLOON_SCORE_1);
|
||||
@@ -2022,6 +2031,7 @@ void Game::destroyBalloon(Balloon *balloon)
|
||||
balloonsPopped += power;
|
||||
|
||||
// Destruye el globo
|
||||
explosions->add(balloon->getPosX(), balloon->getPosY(), size);
|
||||
balloon->pop();
|
||||
|
||||
// Recalcula el nivel de amenaza
|
||||
@@ -2094,10 +2104,7 @@ int Game::countBalloons()
|
||||
{
|
||||
if (balloon->isEnabled())
|
||||
{
|
||||
if (!balloon->isPopping())
|
||||
{
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2223,18 +2230,8 @@ void Game::checkBulletBalloonCollision()
|
||||
players[index]->addScore(Uint32(balloon->getScore() * players[index]->getScoreMultiplier() * difficultyScoreMultiplier));
|
||||
updateHiScore();
|
||||
|
||||
// Explota el globo
|
||||
popBalloon(balloon);
|
||||
|
||||
// Sonido de explosión
|
||||
JA_PlaySound(balloonSound);
|
||||
|
||||
// Deshabilita la bala
|
||||
bullet->disable();
|
||||
|
||||
// Suelta el item en caso de que salga uno
|
||||
// Suelta el item si se da el caso
|
||||
const int droppeditem = dropItem();
|
||||
// if ((droppeditem != NO_KIND) && !(demo.enabled) && !(demo.recording))
|
||||
if ((droppeditem != NO_KIND) && !(demo.recording))
|
||||
{
|
||||
if (droppeditem != ITEM_COFFEE_MACHINE)
|
||||
@@ -2249,6 +2246,15 @@ void Game::checkBulletBalloonCollision()
|
||||
}
|
||||
}
|
||||
|
||||
// Explota el globo
|
||||
popBalloon(balloon);
|
||||
|
||||
// Sonido de explosión
|
||||
JA_PlaySound(balloonSound);
|
||||
|
||||
// Deshabilita la bala
|
||||
bullet->disable();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2726,6 +2732,9 @@ void Game::update()
|
||||
freeBalloons();
|
||||
freeItems();
|
||||
freeSmartSprites();
|
||||
|
||||
// Dibuja los graficos de la zona de juego en la textura
|
||||
fillCanvas();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2793,9 +2802,6 @@ void Game::fillCanvas()
|
||||
// Dibuja el juego
|
||||
void Game::render()
|
||||
{
|
||||
// Dibuja los graficos de la zona de juego en la textura
|
||||
fillCanvas();
|
||||
|
||||
// Prepara para empezar a dibujar en la textura de juego
|
||||
screen->start();
|
||||
|
||||
@@ -2833,7 +2839,7 @@ void Game::updateMenace()
|
||||
if (menaceCurrent < menaceThreshold)
|
||||
{
|
||||
// Crea una formación de enemigos
|
||||
// deployEnemyFormation();
|
||||
deployEnemyFormation();
|
||||
|
||||
// Recalcula el nivel de amenaza con el nuevo globo
|
||||
evaluateAndSetMenace();
|
||||
|
||||
Reference in New Issue
Block a user