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