enhancing title screen

This commit is contained in:
2021-08-27 13:54:57 +02:00
parent 75031038c8
commit ff0102256c
5 changed files with 26 additions and 36 deletions

View File

@@ -74,7 +74,7 @@ void Director::init()
}
// Sección
mSection.name = PROG_SECTION_GAME;
mSection.name = PROG_SECTION_LOGO;
mSection.subsection = 0;
// Textos

View File

@@ -2133,6 +2133,12 @@ void Game::checkPlayerItemCollision(int index)
case ITEM_COFFEE:
mPlayer[index]->giveExtraHit();
JA_PlaySound(mSoundItemPickup);
if (mPlayer[index]->getCoffees() == 2)
{
mPlayer[index]->addScore(5000);
updateHiScore();
createItemScoreSprite(mItem[i]->getPosX() + (mItem[i]->getWidth() / 2) - (m5000Bitmap->getWidth() / 2), mPlayer[index]->getPosY(), m5000Bitmap);
}
break;
case ITEM_COFFEE_MACHINE:
mPlayer[index]->setPowerUp(true);
@@ -2277,10 +2283,10 @@ void Game::resetItems()
// Devuelve un item en función del azar
Uint8 Game::dropItem()
{
if (mPlayer[0]->isPowerUp() || (mCoffeeMachineEnabled))
return NO_KIND;
else
return ITEM_COFFEE_MACHINE;
//if (mPlayer[0]->isPowerUp() || (mCoffeeMachineEnabled))
// return NO_KIND;
//else
// return ITEM_COFFEE_MACHINE;
const Uint8 luckyNumber = rand() % 100;
const Uint8 item = rand() % 6;
@@ -2873,7 +2879,7 @@ void Game::checkGameInput()
}
// Comprueba el input de pausa
if (mInput[i]->checkInput(INPUT_BUTTON_PAUSE, REPEAT_FALSE))
if (mInput[i]->checkInput(INPUT_CANCEL, REPEAT_FALSE))
{
mSection.subsection = GAME_SECTION_PAUSE;
@@ -3159,12 +3165,13 @@ void Game::runPausedGame()
}
// Dibuja los objetos
renderBackground();
renderBalloons();
renderBullets();
for (int i = 0; i < mNumPlayers; i++)
mPlayer[i]->render();
renderScoreBoard();
//renderBackground();
//renderBalloons();
//renderBullets();
//for (int i = 0; i < mNumPlayers; i++)
// mPlayer[i]->render();
//renderScoreBoard();
renderPlayField();
mMenuPause->render();
mFade->render();

View File

@@ -87,7 +87,6 @@ void Item::init(Uint8 value, float x, float y, LTexture *texture, SDL_Renderer *
case ITEM_COFFEE_MACHINE:
mWidth = 32;
mHeight = 32;
//mPosX = (rand() % (PLAY_AREA_WIDTH - mWidth - 3)) + 3;
mPosX = (((int)x + (PLAY_AREA_WIDTH / 2)) % (PLAY_AREA_WIDTH - mWidth - 5)) + 2;
mPosY = PLAY_AREA_TOP - mHeight;
mVelX = 0.0f;
@@ -98,7 +97,6 @@ void Item::init(Uint8 value, float x, float y, LTexture *texture, SDL_Renderer *
mSprite->setAnimationFrames(0, 1, 32 * 1, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 2, 32 * 2, 16 * 2, mWidth, mHeight);
mSprite->setAnimationFrames(0, 3, 32 * 3, 16 * 2, mWidth, mHeight);
//mSprite->setSpriteClip(mSprite->getAnimationClip(0, 0));
mSprite->setPosX(mPosX);
mSprite->setPosY(mPosY);
mCollider.r = 10;
@@ -108,17 +106,6 @@ void Item::init(Uint8 value, float x, float y, LTexture *texture, SDL_Renderer *
default:
break;
}
if (mClass == ITEM_COFFEE_MACHINE)
{
printf("-creation-\n");
printf("x\t%f\n", mPosX);
printf("y\t%f\n", mPosY);
printf("ax\t%f\n", mAccelX);
printf("ay\t%f\n", mAccelY);
printf("r\t%i\n", mCollider.r);
printf("---\n");
}
}
// Centra el objeto en la posición X
@@ -162,16 +149,6 @@ void Item::render()
// Actualiza la posición y estados del objeto
void Item::move()
{
//if (mClass == ITEM_COFFEE_MACHINE)
//{
// printf("-move-\n");
// printf("x\t%f\n", mPosX);
// printf("y\t%f\n", mPosY);
// printf("ax\t%f\n", mAccelX);
// printf("ay\t%f\n", mAccelY);
// printf("---\n");
//}
mStatus = 0;
// Calcula la nueva posición

View File

@@ -65,7 +65,7 @@ void Player::init(float x, int y, LTexture *textureLegs, LTexture *textureBody,
mScore = 0;
// Establece el multiplicador de puntos inicial
mScoreMultiplier = 2.0f;
mScoreMultiplier = 1.0f;
// Inicia el contador para la cadencia de disparo
mCooldown = 10;

View File

@@ -391,6 +391,9 @@ section_t Title::run(Uint8 subsection)
SDL_SetRenderDrawColor(mRenderer, bgColor.r, bgColor.g, bgColor.b, 255);
SDL_RenderClear(mRenderer);
// Dibuja el tileado de fondo
SDL_RenderCopy(mRenderer, mBackground, &mBackgroundWindow, NULL);
// Dibuja los objetos
mCoffeeBitmap->render();
mCrisisBitmap->render();
@@ -437,6 +440,9 @@ section_t Title::run(Uint8 subsection)
SDL_SetRenderDrawColor(mRenderer, bgColor.r, bgColor.g, bgColor.b, 255);
SDL_RenderClear(mRenderer);
// Dibuja el tileado de fondo
SDL_RenderCopy(mRenderer, mBackground, &mBackgroundWindow, NULL);
// Dibuja los objetos
mCoffeeBitmap->setPosX(a + v[n / 3]);
mCrisisBitmap->setPosX(b + v[n / 3]);