fixing some bugs
This commit is contained in:
@@ -171,7 +171,7 @@ Game::~Game()
|
||||
delete mTextureText;
|
||||
mTextureText = nullptr;
|
||||
|
||||
mTextureTextScoreBoard->unload();
|
||||
mTextureTextScoreBoard->unload();
|
||||
delete mTextureTextScoreBoard;
|
||||
mTextureTextScoreBoard = nullptr;
|
||||
|
||||
@@ -182,7 +182,7 @@ Game::~Game()
|
||||
delete mText;
|
||||
mText = nullptr;
|
||||
|
||||
delete mTextScoreBoard;
|
||||
delete mTextScoreBoard;
|
||||
mTextScoreBoard = nullptr;
|
||||
|
||||
delete mTextureTextBig;
|
||||
@@ -401,7 +401,7 @@ void Game::init()
|
||||
mSpriteScoreBoard->init(0, 160, SCREEN_WIDTH, 32, mTextureGameBG, mRenderer);
|
||||
mSpriteScoreBoard->setSpriteClip(0, 160, 256, 32);
|
||||
|
||||
mSpritePowerMeter->init(PLAY_AREA_CENTER_THIRD_QUARTER_X - 20, HISCORE_NUMBER_Y + 4, 40, 8, mTextureGameBG, mRenderer);
|
||||
mSpritePowerMeter->init(PLAY_AREA_CENTER_X - 20, 170, 40, 8, mTextureGameBG, mRenderer);
|
||||
mSpritePowerMeter->setSpriteClip(256, 192 - 8, 40, 8);
|
||||
|
||||
// Vector de jugadores
|
||||
@@ -1592,48 +1592,48 @@ void Game::renderScoreBoard()
|
||||
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
|
||||
mSpritePowerMeter->render();
|
||||
*/
|
||||
const int offset1 = 162;
|
||||
const int offset2 = offset1 + 7;
|
||||
const int offset3 = offset2 + 7;
|
||||
const int offset4 = offset3 + 7;
|
||||
const int offset1 = 163;
|
||||
const int offset2 = offset1 + 8;
|
||||
const int offset3 = offset2 + 8;
|
||||
const int offset4 = offset3 + 8;
|
||||
// PLAYER1 - SCORE
|
||||
mTextScoreBoard->writeCentered(49/2, offset1, mTextStrings[53]);
|
||||
mTextScoreBoard->write(PLAY_AREA_LEFT+1, offset2, updateScoreText(mPlayer[0]->getScore()));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset1, mTextStrings[53]);
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset2, updateScoreText(mPlayer[0]->getScore()));
|
||||
|
||||
// PLAYER1 - MULT
|
||||
mTextScoreBoard->write(PLAY_AREA_LEFT+1, offset3, mTextStrings[55] + std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_LEFT + 30, offset3, mTextStrings[55] + std::to_string(mPlayer[0]->getScoreMultiplier()).substr(0, 3));
|
||||
|
||||
if (mNumPlayers == 2)
|
||||
{
|
||||
// PLAYER2 - SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - (49/2), offset1, mTextStrings[54]);
|
||||
mTextScoreBoard->write(PLAY_AREA_RIGHT - 49, offset2, updateScoreText(mPlayer[1]->getScore()));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mTextStrings[54]);
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, updateScoreText(mPlayer[1]->getScore()));
|
||||
|
||||
// PLAYER2 - MULT
|
||||
mTextScoreBoard->write(PLAY_AREA_RIGHT - (8 * 10), offset3, mTextStrings[55]+std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mTextStrings[55] + std::to_string(mPlayer[1]->getScoreMultiplier()).substr(0, 3));
|
||||
}
|
||||
else
|
||||
{
|
||||
// PLAYER2 - SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - (49/2), offset1, mTextStrings[54]);
|
||||
mTextScoreBoard->write(PLAY_AREA_RIGHT - 49, offset2, "0000000");
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset1, mTextStrings[54]);
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset2, "0000000");
|
||||
|
||||
// PLAYER2 - MULT
|
||||
mTextScoreBoard->write(PLAY_AREA_RIGHT - (8 * 10), offset3, mTextStrings[55] + "1.0");
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_RIGHT - 30, offset3, mTextStrings[55] + "1.0");
|
||||
}
|
||||
|
||||
// STAGE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1, mTextStrings[57] + std::to_string(mStage[mCurrentStage].number));
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset1-1, mTextStrings[57] + std::to_string(mStage[mCurrentStage].number));
|
||||
|
||||
// POWER
|
||||
//mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
|
||||
//mSpritePowerMeter->render();
|
||||
//const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
|
||||
//mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
|
||||
//mSpritePowerMeter->render();
|
||||
mSpritePowerMeter->setSpriteClip(256, 184, 40, 8);
|
||||
mSpritePowerMeter->render();
|
||||
const float percent = (mStage[mCurrentStage].currentPower * 40.0f) / mStage[mCurrentStage].powerToComplete;
|
||||
mSpritePowerMeter->setSpriteClip(296, 184, (int)percent, 8);
|
||||
mSpritePowerMeter->render();
|
||||
|
||||
// HI-SCORE
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset4, mTextStrings[56] + "0000000");
|
||||
mTextScoreBoard->writeCentered(PLAY_AREA_CENTER_X, offset3+1, mTextStrings[56] + updateScoreText(mHiScore));
|
||||
}
|
||||
|
||||
// Actualiza las variables del jugador
|
||||
@@ -2269,10 +2269,10 @@ void Game::resetItems()
|
||||
// Devuelve un item en función del azar
|
||||
Uint8 Game::dropItem()
|
||||
{
|
||||
/*if (mPlayer->isPowerUp() || (mCoffeeMachineEnabled))
|
||||
if (mPlayer[0]->isPowerUp() || (mCoffeeMachineEnabled))
|
||||
return NO_KIND;
|
||||
else
|
||||
return ITEM_COFFEE_MACHINE;*/
|
||||
return ITEM_COFFEE_MACHINE;
|
||||
|
||||
const Uint8 luckyNumber = rand() % 100;
|
||||
const Uint8 item = rand() % 6;
|
||||
|
||||
Reference in New Issue
Block a user