Ya se puede continuar al morir
This commit is contained in:
@@ -52,7 +52,7 @@ frames=24,25,26,27
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot
|
name=centershoot
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=28,29,30,31
|
frames=28,29,30,31
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -66,7 +66,7 @@ frames=32,33,34,35
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_1C
|
name=centershoot_1C
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=36,37,38,39
|
frames=36,37,38,39
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -80,7 +80,7 @@ frames=40,41,42,43
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_2C
|
name=centershoot_2C
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=44,45,46,47
|
frames=44,45,46,47
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -66,7 +66,7 @@ frames=32,33,34,35
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot
|
name=centershoot
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=36,37,38,39
|
frames=36,37,38,39
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -80,7 +80,7 @@ frames=40,41,42,43
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_1C
|
name=centershoot_1C
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=44,45,46,47
|
frames=44,45,46,47
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -94,7 +94,7 @@ frames=48,49,50,51
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_pwr
|
name=centershoot_pwr
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=52,53,54,55
|
frames=52,53,54,55
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -108,7 +108,7 @@ frames=56,57,58,59
|
|||||||
|
|
||||||
[animation]
|
[animation]
|
||||||
name=centershoot_1C_pwr
|
name=centershoot_1C_pwr
|
||||||
speed=10
|
speed=5
|
||||||
loop=0
|
loop=0
|
||||||
frames=60,61,62,63
|
frames=60,61,62,63
|
||||||
[/animation]
|
[/animation]
|
||||||
@@ -210,7 +210,14 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
|
|||||||
// Añade rotación al sprite
|
// Añade rotación al sprite
|
||||||
sprite->setRotate(false);
|
sprite->setRotate(false);
|
||||||
sprite->setRotateSpeed(0);
|
sprite->setRotateSpeed(0);
|
||||||
|
if (velX > 0.0f)
|
||||||
|
{
|
||||||
sprite->setRotateAmount(2.0);
|
sprite->setRotateAmount(2.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite->setRotateAmount(-2.0);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -258,15 +265,16 @@ Balloon::Balloon(float x, float y, Uint8 kind, float velx, float speed, Uint16 c
|
|||||||
creationCounterIni = creationtimer;
|
creationCounterIni = creationtimer;
|
||||||
popping = false;
|
popping = false;
|
||||||
|
|
||||||
|
// Actualiza valores
|
||||||
|
beingCreated = creationCounter == 0 ? false : true;
|
||||||
|
invulnerable = beingCreated == false ? false : true;
|
||||||
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
travelY = 1.0f;
|
travelY = 1.0f;
|
||||||
this->speed = speed;
|
this->speed = speed;
|
||||||
|
|
||||||
// Tipo
|
// Tipo
|
||||||
this->kind = kind;
|
this->kind = kind;
|
||||||
|
|
||||||
// Selecciona un frame para pintar
|
|
||||||
sprite->setSpriteClip(sprite->getAnimationClip(0, 0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
@@ -505,7 +513,6 @@ void Balloon::updateState()
|
|||||||
{
|
{
|
||||||
disable();
|
disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si se está creando
|
// Si se está creando
|
||||||
@@ -552,28 +559,32 @@ void Balloon::updateState()
|
|||||||
if (kind == POWER_BALL)
|
if (kind == POWER_BALL)
|
||||||
{
|
{
|
||||||
sprite->setRotate(true);
|
sprite->setRotate(true);
|
||||||
if (velX > 0.0f)
|
|
||||||
{
|
|
||||||
sprite->setRotateAmount(2.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprite->setRotateAmount(-2.0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Solo comprueba el estado detenido cuando no se está creando
|
// Solo comprueba el estado detenido cuando no se está creando
|
||||||
else if (isStopped())
|
else if (isStopped())
|
||||||
{
|
{
|
||||||
// Si está detenido, reduce el contador
|
// Si es una powerball deja de rodar
|
||||||
|
if (kind == POWER_BALL)
|
||||||
|
{
|
||||||
|
sprite->setRotate(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reduce el contador
|
||||||
if (stoppedCounter > 0)
|
if (stoppedCounter > 0)
|
||||||
{
|
{
|
||||||
stoppedCounter--;
|
stoppedCounter--;
|
||||||
}
|
}
|
||||||
// Si el contador ha llegado a cero, ya no está detenido
|
// Quitarles el estado "detenido" si no estan explosionando
|
||||||
else if (!isPopping())
|
else if (!isPopping())
|
||||||
{ // Quitarles el estado "detenido" si no estan explosionando
|
{
|
||||||
|
// Si es una powerball vuelve a rodar
|
||||||
|
if (kind == POWER_BALL)
|
||||||
|
{
|
||||||
|
sprite->setRotate(true);
|
||||||
|
}
|
||||||
|
|
||||||
setStop(false);
|
setStop(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
171
source/game.cpp
171
source/game.cpp
@@ -15,7 +15,7 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
|||||||
// Pasa variables
|
// Pasa variables
|
||||||
mDemo.enabled = demo;
|
mDemo.enabled = demo;
|
||||||
mNumPlayers = numPlayers;
|
mNumPlayers = numPlayers;
|
||||||
mCurrentStage = currentStage;
|
this->mCurrentStage = 5; // currentStage;
|
||||||
mLastStageReached = currentStage;
|
mLastStageReached = currentStage;
|
||||||
if (mNumPlayers == 1)
|
if (mNumPlayers == 1)
|
||||||
{
|
{
|
||||||
@@ -24,21 +24,6 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
|||||||
mDifficulty = mOptions->difficulty;
|
mDifficulty = mOptions->difficulty;
|
||||||
|
|
||||||
// Crea los objetos
|
// Crea los objetos
|
||||||
// Vector de jugadores
|
|
||||||
if (mNumPlayers == 1)
|
|
||||||
{
|
|
||||||
Player *player = new Player(mRenderer, mAsset, PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24);
|
|
||||||
players.push_back(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if (mNumPlayers == 2)
|
|
||||||
{
|
|
||||||
Player *player1 = new Player(mRenderer, mAsset, (PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24);
|
|
||||||
Player *player2 = new Player(mRenderer, mAsset, (PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24);
|
|
||||||
players.push_back(player1);
|
|
||||||
players.push_back(player2);
|
|
||||||
}
|
|
||||||
|
|
||||||
balloon1Texture = new LTexture(mRenderer, mAsset->get("balloon1.png"));
|
balloon1Texture = new LTexture(mRenderer, mAsset->get("balloon1.png"));
|
||||||
balloon2Texture = new LTexture(mRenderer, mAsset->get("balloon2.png"));
|
balloon2Texture = new LTexture(mRenderer, mAsset->get("balloon2.png"));
|
||||||
balloon3Texture = new LTexture(mRenderer, mAsset->get("balloon3.png"));
|
balloon3Texture = new LTexture(mRenderer, mAsset->get("balloon3.png"));
|
||||||
@@ -85,6 +70,9 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
|
|||||||
mSpriteGrass = new Sprite(0, 85, GAME_WIDTH, 6, mTextureGameBG, mRenderer);
|
mSpriteGrass = new Sprite(0, 85, GAME_WIDTH, 6, mTextureGameBG, mRenderer);
|
||||||
mSpritePowerMeter = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 8, mTextureGameBG, mRenderer);
|
mSpritePowerMeter = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 8, mTextureGameBG, mRenderer);
|
||||||
mSpriteScoreBoard = new Sprite(0, 160, GAME_WIDTH, 32, mTextureGameBG, mRenderer);
|
mSpriteScoreBoard = new Sprite(0, 160, GAME_WIDTH, 32, mTextureGameBG, mRenderer);
|
||||||
|
|
||||||
|
// Inicializa las variables necesarias para la sección 'Game'
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::~Game()
|
Game::~Game()
|
||||||
@@ -94,30 +82,8 @@ Game::~Game()
|
|||||||
|
|
||||||
mOptions->input[0].deviceType = mOnePlayerControl;
|
mOptions->input[0].deviceType = mOnePlayerControl;
|
||||||
|
|
||||||
for (auto player : players)
|
// Elimina todos los objetos contenidos en vectores
|
||||||
{
|
deleteAllVectorObjects();
|
||||||
delete player;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto ballon : balloons)
|
|
||||||
{
|
|
||||||
delete ballon;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto bullet : bullets)
|
|
||||||
{
|
|
||||||
delete bullet;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto item : items)
|
|
||||||
{
|
|
||||||
delete item;
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto smartSprite : smartSprites)
|
|
||||||
{
|
|
||||||
delete smartSprite;
|
|
||||||
};
|
|
||||||
|
|
||||||
balloon1Texture->unload();
|
balloon1Texture->unload();
|
||||||
delete balloon1Texture;
|
delete balloon1Texture;
|
||||||
@@ -213,6 +179,27 @@ void Game::init()
|
|||||||
mTicks = 0;
|
mTicks = 0;
|
||||||
mTicksSpeed = 15;
|
mTicksSpeed = 15;
|
||||||
|
|
||||||
|
// Crea los jugadores
|
||||||
|
for (auto player : players)
|
||||||
|
{
|
||||||
|
delete player;
|
||||||
|
};
|
||||||
|
players.clear();
|
||||||
|
|
||||||
|
if (mNumPlayers == 1)
|
||||||
|
{
|
||||||
|
Player *player = new Player(mRenderer, mAsset, PLAY_AREA_CENTER_X - 11, PLAY_AREA_BOTTOM - 24);
|
||||||
|
players.push_back(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (mNumPlayers == 2)
|
||||||
|
{
|
||||||
|
Player *player1 = new Player(mRenderer, mAsset, (PLAY_AREA_CENTER_FIRST_QUARTER_X * ((0 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24);
|
||||||
|
Player *player2 = new Player(mRenderer, mAsset, (PLAY_AREA_CENTER_FIRST_QUARTER_X * ((1 * 2) + 1)) - 11, PLAY_AREA_BOTTOM - 24);
|
||||||
|
players.push_back(player1);
|
||||||
|
players.push_back(player2);
|
||||||
|
}
|
||||||
|
|
||||||
// Inicializa las variables
|
// Inicializa las variables
|
||||||
switch (mDifficulty)
|
switch (mDifficulty)
|
||||||
{
|
{
|
||||||
@@ -241,7 +228,6 @@ void Game::init()
|
|||||||
mMenaceCurrent = 0;
|
mMenaceCurrent = 0;
|
||||||
mMenaceThreshold = 0;
|
mMenaceThreshold = 0;
|
||||||
mHiScoreAchieved = false;
|
mHiScoreAchieved = false;
|
||||||
// mCurrentStage = 0;
|
|
||||||
mStageBitmapCounter = STAGE_COUNTER;
|
mStageBitmapCounter = STAGE_COUNTER;
|
||||||
mDeathCounter = DEATH_COUNTER;
|
mDeathCounter = DEATH_COUNTER;
|
||||||
mTimeStopped = false;
|
mTimeStopped = false;
|
||||||
@@ -267,7 +253,6 @@ void Game::init()
|
|||||||
mPowerBallCounter = 0;
|
mPowerBallCounter = 0;
|
||||||
mCoffeeMachineEnabled = false;
|
mCoffeeMachineEnabled = false;
|
||||||
mPostFade = 0;
|
mPostFade = 0;
|
||||||
// mLastStageReached = 0;
|
|
||||||
|
|
||||||
if (mDemo.enabled)
|
if (mDemo.enabled)
|
||||||
{
|
{
|
||||||
@@ -309,35 +294,6 @@ void Game::init()
|
|||||||
// Inicializa el objeto para el fundido
|
// Inicializa el objeto para el fundido
|
||||||
mFade->init(0x27, 0x27, 0x36);
|
mFade->init(0x27, 0x27, 0x36);
|
||||||
|
|
||||||
// Inicializa el objeto con el menu de pausa
|
|
||||||
// mMenuPause->setName("PAUSE");
|
|
||||||
// mMenuPause->setPos(0, 12 * BLOCK);
|
|
||||||
// mMenuPause->setBackgroundType(MENU_BACKGROUND_SOLID);
|
|
||||||
// mMenuPause->addItem(mLang->getText(46), 2);
|
|
||||||
// mMenuPause->addItem(mLang->getText(47), 0);
|
|
||||||
// mMenuPause->setDefaultActionWhenCancel(0);
|
|
||||||
// mMenuPause->setBackgroundColor({0x29, 0x39, 0x41}, 240);
|
|
||||||
// mMenuPause->setSelectorColor({0xFF, 0x7A, 0x00}, 255);
|
|
||||||
// mMenuPause->setSelectorTextColor({0xFF, 0xFF, 0xFF});
|
|
||||||
// mMenuPause->centerMenuOnX(SCREEN_CENTER_X);
|
|
||||||
// mMenuPause->centerMenuElementsOnX();
|
|
||||||
|
|
||||||
// Inicializa el objeto con el menu de la pantalla de game over
|
|
||||||
// mMenuGameOver->setName("GAME OVER");
|
|
||||||
// mMenuGameOver->setPos(0, PLAY_AREA_CENTER_Y + BLOCK * 4);
|
|
||||||
// mMenuGameOver->setBackgroundType(MENU_BACKGROUND_TRANSPARENT);
|
|
||||||
// mMenuGameOver->addItem(mLang->getText(48), 2);
|
|
||||||
// mMenuGameOver->addItem(mLang->getText(49));
|
|
||||||
// mMenuGameOver->setDefaultActionWhenCancel(1);
|
|
||||||
// mMenuGameOver->setBackgroundColor({0, 0, 0}, 255);
|
|
||||||
// mMenuGameOver->setSelectorColor({0x54, 0x6e, 0x7a}, 255);
|
|
||||||
// mMenuGameOver->setSelectorColor({0x54, 0x6e, 0x7a}, 0);
|
|
||||||
// mMenuGameOver->setSelectorTextColor({0xFF, 0xFF, 0xFF});
|
|
||||||
// mMenuGameOver->setSelectorTextColor({0xFF, 0xF1, 0x76});
|
|
||||||
// mMenuGameOver->setSelectorTextColor({0xFF, 0x7A, 0x00});
|
|
||||||
// mMenuGameOver->centerMenuOnX(SCREEN_CENTER_X);
|
|
||||||
// mMenuGameOver->centerMenuElementsOnX();
|
|
||||||
|
|
||||||
// Sprites
|
// Sprites
|
||||||
mClouds1a->setSpriteClip(256, 0, 256, 52);
|
mClouds1a->setSpriteClip(256, 0, 256, 52);
|
||||||
mClouds1b->setSpriteClip(256, 0, 256, 52);
|
mClouds1b->setSpriteClip(256, 0, 256, 52);
|
||||||
@@ -1469,21 +1425,21 @@ void Game::renderScoreBoard()
|
|||||||
|
|
||||||
// PLAYER1 - SCORE
|
// PLAYER1 - SCORE
|
||||||
mTextScoreBoard->writeCentered(offsetLeft, offset1, mLang->getText(53));
|
mTextScoreBoard->writeCentered(offsetLeft, offset1, mLang->getText(53));
|
||||||
mTextScoreBoard->writeCentered(offsetLeft, offset2, updateScoreText(players[0]->getScore()));
|
mTextScoreBoard->writeCentered(offsetLeft, offset2, updateScoreText(players.at(0)->getScore()));
|
||||||
|
|
||||||
// PLAYER1 - MULT
|
// PLAYER1 - MULT
|
||||||
mTextScoreBoard->writeCentered(offsetLeft, offset3, mLang->getText(55));
|
mTextScoreBoard->writeCentered(offsetLeft, offset3, mLang->getText(55));
|
||||||
mTextScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(players[0]->getScoreMultiplier()).substr(0, 3));
|
mTextScoreBoard->writeCentered(offsetLeft, offset4, std::to_string(players.at(0)->getScoreMultiplier()).substr(0, 3));
|
||||||
|
|
||||||
if (mNumPlayers == 2)
|
if (mNumPlayers == 2)
|
||||||
{
|
{
|
||||||
// PLAYER2 - SCORE
|
// PLAYER2 - SCORE
|
||||||
mTextScoreBoard->writeCentered(offsetRight, offset1, mLang->getText(54));
|
mTextScoreBoard->writeCentered(offsetRight, offset1, mLang->getText(54));
|
||||||
mTextScoreBoard->writeCentered(offsetRight, offset2, updateScoreText(players[1]->getScore()));
|
mTextScoreBoard->writeCentered(offsetRight, offset2, updateScoreText(players.at(1)->getScore()));
|
||||||
|
|
||||||
// PLAYER2 - MULT
|
// PLAYER2 - MULT
|
||||||
mTextScoreBoard->writeCentered(offsetRight, offset3, mLang->getText(55));
|
mTextScoreBoard->writeCentered(offsetRight, offset3, mLang->getText(55));
|
||||||
mTextScoreBoard->writeCentered(offsetRight, offset4, std::to_string(players[1]->getScoreMultiplier()).substr(0, 3));
|
mTextScoreBoard->writeCentered(offsetRight, offset4, std::to_string(players.at(1)->getScoreMultiplier()).substr(0, 3));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1744,10 +1700,11 @@ void Game::createPowerBall()
|
|||||||
const int center = PLAY_AREA_CENTER_X - (BALLOON_WIDTH_4 / 2);
|
const int center = PLAY_AREA_CENTER_X - (BALLOON_WIDTH_4 / 2);
|
||||||
const int right = PLAY_AREA_RIGHT - BALLOON_WIDTH_4;
|
const int right = PLAY_AREA_RIGHT - BALLOON_WIDTH_4;
|
||||||
|
|
||||||
|
const int luck =rand() % 3;
|
||||||
const int x[3] = {left, center, right};
|
const int x[3] = {left, center, right};
|
||||||
const int posX = x[rand() % 3];
|
const float vx[3] = {BALLOON_VELX_POSITIVE, BALLOON_VELX_POSITIVE, BALLOON_VELX_NEGATIVE};
|
||||||
|
|
||||||
Balloon *b = new Balloon(posX, posY, POWER_BALL, BALLOON_VELX_POSITIVE * (((rand() % 2) * 2) - 1), mEnemySpeed, 100, balloon4Texture, balloon4Animation, mRenderer);
|
Balloon *b = new Balloon(x[luck], posY, POWER_BALL, vx[luck], mEnemySpeed, 100, balloon4Texture, balloon4Animation, mRenderer);
|
||||||
balloons.push_back(b);
|
balloons.push_back(b);
|
||||||
|
|
||||||
mPowerBallEnabled = true;
|
mPowerBallEnabled = true;
|
||||||
@@ -3163,8 +3120,6 @@ void Game::shakeScreen()
|
|||||||
// Bucle para el juego
|
// Bucle para el juego
|
||||||
section_t Game::run()
|
section_t Game::run()
|
||||||
{
|
{
|
||||||
init();
|
|
||||||
|
|
||||||
while (mSection.name == PROG_SECTION_GAME)
|
while (mSection.name == PROG_SECTION_GAME)
|
||||||
{
|
{
|
||||||
// Sección juego en pausa
|
// Sección juego en pausa
|
||||||
@@ -3351,17 +3306,9 @@ void Game::runGameOverScreen()
|
|||||||
{
|
{
|
||||||
case 0: // YES
|
case 0: // YES
|
||||||
mSection.name = PROG_SECTION_GAME;
|
mSection.name = PROG_SECTION_GAME;
|
||||||
|
deleteAllVectorObjects();
|
||||||
if (mNumPlayers == 1)
|
|
||||||
{
|
|
||||||
mSection.subsection = GAME_SECTION_PLAY_1P;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mSection.subsection = GAME_SECTION_PLAY_2P;
|
|
||||||
}
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
mSection.subsection = mNumPlayers == 1 ? GAME_SECTION_PLAY_1P : GAME_SECTION_PLAY_2P;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // NO
|
case 1: // NO
|
||||||
@@ -3387,13 +3334,13 @@ void Game::runGameOverScreen()
|
|||||||
if (mNumPlayers == 1)
|
if (mNumPlayers == 1)
|
||||||
{
|
{
|
||||||
mTextBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), mLang->getText(43));
|
mTextBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), mLang->getText(43));
|
||||||
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 1), mLang->getText(44) + std::to_string(players[0]->getScore()));
|
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 1), mLang->getText(44) + std::to_string(players.at(0)->getScore()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mTextBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 36, mLang->getText(43));
|
mTextBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 36, mLang->getText(43));
|
||||||
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 12, mLang->getText(77) + std::to_string(players[0]->getScore()));
|
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 12, mLang->getText(77) + std::to_string(players.at(0)->getScore()));
|
||||||
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y, mLang->getText(78) + std::to_string(players[1]->getScore()));
|
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y, mLang->getText(78) + std::to_string(players.at(1)->getScore()));
|
||||||
}
|
}
|
||||||
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y + BLOCK * 2, mLang->getText(45));
|
mText->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y + BLOCK * 2, mLang->getText(45));
|
||||||
mMenuGameOver->render();
|
mMenuGameOver->render();
|
||||||
@@ -3437,7 +3384,7 @@ void Game::renderDebugInfo()
|
|||||||
mText->writeShadowed(2, 2 + 3 * BLOCK, "mCounter: " + std::to_string(mCounter), color);
|
mText->writeShadowed(2, 2 + 3 * BLOCK, "mCounter: " + std::to_string(mCounter), color);
|
||||||
mText->writeShadowed(2, 2 + 4 * BLOCK, "(R)enemyset: " + std::to_string(mDebug.enemySet), color);
|
mText->writeShadowed(2, 2 + 4 * BLOCK, "(R)enemyset: " + std::to_string(mDebug.enemySet), color);
|
||||||
mText->writeShadowed(2, 2 + 5 * BLOCK, "RGB: " + std::to_string(mDebug.gradR) + "," + std::to_string(mDebug.gradG) + "," + std::to_string(mDebug.gradB), color);
|
mText->writeShadowed(2, 2 + 5 * BLOCK, "RGB: " + std::to_string(mDebug.gradR) + "," + std::to_string(mDebug.gradG) + "," + std::to_string(mDebug.gradB), color);
|
||||||
mText->writeShadowed(2, 2 + 6 * BLOCK, "(I)invuln: " + std::to_string(players[0]->getInvulnerableCounter()), color);
|
mText->writeShadowed(2, 2 + 6 * BLOCK, "(I)invuln: " + std::to_string(players.at(0)->getInvulnerableCounter()), color);
|
||||||
mText->writeShadowed(2, 2 + 7 * BLOCK, "balloons: " + std::to_string(countBalloons()), color);
|
mText->writeShadowed(2, 2 + 7 * BLOCK, "balloons: " + std::to_string(countBalloons()), color);
|
||||||
mText->writeShadowed(2, 2 + 8 * BLOCK, "balloonsPop: " + std::to_string(mBalloonsPopped), color);
|
mText->writeShadowed(2, 2 + 8 * BLOCK, "balloonsPop: " + std::to_string(mBalloonsPopped), color);
|
||||||
mText->writeShadowed(2, 2 + 9 * BLOCK, "(Z-X)ballSped:" + std::to_string(mEnemySpeed), color);
|
mText->writeShadowed(2, 2 + 9 * BLOCK, "(Z-X)ballSped:" + std::to_string(mEnemySpeed), color);
|
||||||
@@ -3611,6 +3558,10 @@ void Game::checkEventHandler()
|
|||||||
createPowerBall();
|
createPowerBall();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SDL_SCANCODE_O:
|
||||||
|
stopAllBalloons(200);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3634,3 +3585,37 @@ void Game::loadAnimations(std::string filePath, std::vector<std::string> *buffer
|
|||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Elimina todos los objetos contenidos en vectores
|
||||||
|
void Game::deleteAllVectorObjects()
|
||||||
|
{
|
||||||
|
for (auto player : players)
|
||||||
|
{
|
||||||
|
delete player;
|
||||||
|
};
|
||||||
|
players.clear();
|
||||||
|
|
||||||
|
for (auto ballon : balloons)
|
||||||
|
{
|
||||||
|
delete ballon;
|
||||||
|
};
|
||||||
|
balloons.clear();
|
||||||
|
|
||||||
|
for (auto bullet : bullets)
|
||||||
|
{
|
||||||
|
delete bullet;
|
||||||
|
};
|
||||||
|
bullets.clear();
|
||||||
|
|
||||||
|
for (auto item : items)
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
};
|
||||||
|
items.clear();
|
||||||
|
|
||||||
|
for (auto smartSprite : smartSprites)
|
||||||
|
{
|
||||||
|
delete smartSprite;
|
||||||
|
};
|
||||||
|
smartSprites.clear();
|
||||||
|
}
|
||||||
@@ -512,6 +512,9 @@ private:
|
|||||||
// Carga las animaciones
|
// Carga las animaciones
|
||||||
void loadAnimations(std::string filePath, std::vector<std::string> *buffer);
|
void loadAnimations(std::string filePath, std::vector<std::string> *buffer);
|
||||||
|
|
||||||
|
// Elimina todos los objetos contenidos en vectores
|
||||||
|
void deleteAllVectorObjects();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *mAsset, Lang *lang, Input *input, bool demo, options_t *options);
|
Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *screen, Asset *mAsset, Lang *lang, Input *input, bool demo, options_t *options);
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
#include "item.h"
|
#include "item.h"
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Item::Item(SDL_Renderer *renderer, Asset *asset, Uint8 type, float x, float y)
|
Item::Item(SDL_Renderer *renderer, Asset *asset, Uint8 kind, float x, float y)
|
||||||
{
|
{
|
||||||
std::string filePNG;
|
std::string filePNG;
|
||||||
std::string fileANI;
|
std::string fileANI;
|
||||||
switch (type)
|
switch (kind)
|
||||||
{
|
{
|
||||||
case ITEM_POINTS_1_DISK:
|
case ITEM_POINTS_1_DISK:
|
||||||
filePNG = asset->get("item_points1_disk.png");
|
filePNG = asset->get("item_points1_disk.png");
|
||||||
@@ -45,13 +45,13 @@ Item::Item(SDL_Renderer *renderer, Asset *asset, Uint8 type, float x, float y)
|
|||||||
texture = new LTexture(renderer, filePNG);
|
texture = new LTexture(renderer, filePNG);
|
||||||
sprite = new AnimatedSprite(texture, renderer, fileANI);
|
sprite = new AnimatedSprite(texture, renderer, fileANI);
|
||||||
|
|
||||||
this->type = type;
|
this->kind = kind;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
timeToLive = 600;
|
timeToLive = 600;
|
||||||
accelX = 0.0f;
|
accelX = 0.0f;
|
||||||
floorCollision = false;
|
floorCollision = false;
|
||||||
|
|
||||||
if (type == ITEM_COFFEE_MACHINE)
|
if (kind == ITEM_COFFEE_MACHINE)
|
||||||
{
|
{
|
||||||
width = 23;
|
width = 23;
|
||||||
height = 29;
|
height = 29;
|
||||||
@@ -148,10 +148,10 @@ void Item::move()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Si se sale por arriba rebota (excepto la maquina de café)
|
// Si se sale por arriba rebota (excepto la maquina de café)
|
||||||
if ((posY < PLAY_AREA_TOP) && !(type == ITEM_COFFEE_MACHINE))
|
if ((posY < PLAY_AREA_TOP) && !(kind == ITEM_COFFEE_MACHINE))
|
||||||
{
|
{
|
||||||
// Corrige
|
// Corrige
|
||||||
posY = PLAY_AREA_TOP;
|
posY -= velY;
|
||||||
|
|
||||||
// Invierte el sentido
|
// Invierte el sentido
|
||||||
velY = -velY;
|
velY = -velY;
|
||||||
@@ -169,7 +169,7 @@ void Item::move()
|
|||||||
accelX = 0;
|
accelX = 0;
|
||||||
accelY = 0;
|
accelY = 0;
|
||||||
posY = PLAY_AREA_BOTTOM - height;
|
posY = PLAY_AREA_BOTTOM - height;
|
||||||
if (type == ITEM_COFFEE_MACHINE)
|
if (kind == ITEM_COFFEE_MACHINE)
|
||||||
{
|
{
|
||||||
floorCollision = true;
|
floorCollision = true;
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ int Item::getHeight()
|
|||||||
// Obtiene del valor de la variable
|
// Obtiene del valor de la variable
|
||||||
int Item::getClass()
|
int Item::getClass()
|
||||||
{
|
{
|
||||||
return type;
|
return kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtiene el valor de la variable
|
// Obtiene el valor de la variable
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ private:
|
|||||||
float accelX; // Aceleración en el eje X
|
float accelX; // Aceleración en el eje X
|
||||||
float accelY; // Aceleración en el eje Y
|
float accelY; // Aceleración en el eje Y
|
||||||
bool floorCollision; // Indica si el objeto colisiona con el suelo
|
bool floorCollision; // Indica si el objeto colisiona con el suelo
|
||||||
Uint8 type; // Especifica el tipo de objeto que es
|
Uint8 kind; // Especifica el tipo de objeto que es
|
||||||
bool enabled; // Especifica si el objeto está habilitado
|
bool enabled; // Especifica si el objeto está habilitado
|
||||||
circle_t collider; // Circulo de colisión del objeto
|
circle_t collider; // Circulo de colisión del objeto
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public:
|
|||||||
Uint16 timeToLive; // Temporizador con el tiempo que el objeto está presente
|
Uint16 timeToLive; // Temporizador con el tiempo que el objeto está presente
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Item(SDL_Renderer *renderer, Asset *asset, Uint8 type, float x, float y);
|
Item(SDL_Renderer *renderer, Asset *asset, Uint8 kind, float x, float y);
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~Item();
|
~Item();
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ void Player::setAnimation()
|
|||||||
{ // No esta disparando
|
{ // No esta disparando
|
||||||
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees);
|
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees);
|
||||||
bodySprite->setFlip(flipWalk);
|
bodySprite->setFlip(flipWalk);
|
||||||
headSprite->setCurrentAnimation(aWalking + aHeadCoffees);
|
headSprite->setCurrentAnimation(aWalking + aHeadCoffees+ aPowerUp);
|
||||||
headSprite->setFlip(flipWalk);
|
headSprite->setFlip(flipWalk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
12
todo.txt
12
todo.txt
@@ -1,6 +1,6 @@
|
|||||||
los items se quedan pegados en el techo
|
los items se quedan pegados en el techo (comprobar si sigue pasando, he cambiado la coreción al chocar arriba. Si sigue fallando se quita la comprobación superior)
|
||||||
x la maquina de cafe no toca el suelo
|
x la maquina de cafe no toca el suelo
|
||||||
las bolas verdes nacen naranja al explotarlas
|
x las bolas verdes nacen naranja al explotarlas
|
||||||
falta el aura de superguerrero al pillar la maquina de cafe
|
falta el aura de superguerrero al pillar la maquina de cafe
|
||||||
x la powerball deja la mascara al explotarlas
|
x la powerball deja la mascara al explotarlas
|
||||||
los menus de pausa y game over falta poner bien los textos
|
los menus de pausa y game over falta poner bien los textos
|
||||||
@@ -14,4 +14,10 @@ que aumente la velocidad de las nubes conforme avanzas
|
|||||||
retocar un poco la distancia entre los cambios de color del cielo, se llega al oscuro muy pronto
|
retocar un poco la distancia entre los cambios de color del cielo, se llega al oscuro muy pronto
|
||||||
x las balas deberian llegar a salir de la pantalla
|
x las balas deberian llegar a salir de la pantalla
|
||||||
hacer desaparecer los accesos a disco en el juego. cargar todos los recursos previamente y pasarlos por punteros
|
hacer desaparecer los accesos a disco en el juego. cargar todos los recursos previamente y pasarlos por punteros
|
||||||
la powerball nace rodando
|
x la powerball se para con el reloj y sigue rodando
|
||||||
|
x acelerar la animacion de disparar recto
|
||||||
|
x no pone la animacion corecta al no disparar con el powerup
|
||||||
|
que grite "yiiijaa!" o algo parecido al coger la maquina de cafe
|
||||||
|
o que diga DIMONIS! en un globo de texto que se evapore
|
||||||
|
podrian salir comentarios aleatoriamente o con ciertos eventos (falta ver si no estorbará)
|
||||||
|
que se vea el nivel de dificultad
|
||||||
Reference in New Issue
Block a user