Trabajando en la pantalla de game over

This commit is contained in:
2022-10-07 18:30:41 +02:00
parent bb20522172
commit 698721ae03
5 changed files with 20 additions and 5 deletions

BIN
data/gfx/menu_game_over.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -7,13 +7,13 @@ sound_move=menu_move.wav
name=GAME OVER name=GAME OVER
x=0 x=0
y=112 y=96
backgroundType=0 backgroundType=0
backgroundColor=0,0,0,255 backgroundColor=0,0,0,255
areElementsCenteredOnX=true areElementsCenteredOnX=true
isCenteredOnX=true isCenteredOnX=true
centerX=128 centerX=199
selector_color=84,110,122,0 selector_color=84,110,122,0
selector_text_color=255,122,0 selector_text_color=255,122,0

View File

@@ -215,6 +215,7 @@ bool Director::setFileList()
asset->add("data/gfx/intro.png", t_bitmap); asset->add("data/gfx/intro.png", t_bitmap);
asset->add("data/gfx/logo.png", t_bitmap); asset->add("data/gfx/logo.png", t_bitmap);
asset->add("data/gfx/menu_game_over.png", t_bitmap);
asset->add("data/gfx/item_points1_disk.png", t_bitmap); asset->add("data/gfx/item_points1_disk.png", t_bitmap);
asset->add("data/gfx/item_points1_disk.ani", t_data); asset->add("data/gfx/item_points1_disk.ani", t_data);

View File

@@ -44,6 +44,7 @@ Game::Game(int numPlayers, int currentStage, SDL_Renderer *renderer, Screen *scr
skyColorsSprite = new Sprite(0, 0, GAME_WIDTH, GAME_HEIGHT, gameSkyColorsTexture, renderer); skyColorsSprite = new Sprite(0, 0, GAME_WIDTH, GAME_HEIGHT, gameSkyColorsTexture, renderer);
grassSprite = new Sprite(0, 0, 256, 6, gameGrassTexture, renderer); grassSprite = new Sprite(0, 0, 256, 6, gameGrassTexture, renderer);
powerMeterSprite = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 7, gamePowerMeterTexture, renderer); powerMeterSprite = new Sprite(PLAY_AREA_CENTER_X - 20, 170, 40, 7, gamePowerMeterTexture, renderer);
gameOverSprite = new Sprite(16, 80, 128, 96, gameOverTexture, renderer);
// Inicializa las variables necesarias para la sección 'Game' // Inicializa las variables necesarias para la sección 'Game'
init(); init();
@@ -84,6 +85,9 @@ Game::~Game()
gameTextTexture->unload(); gameTextTexture->unload();
delete gameTextTexture; delete gameTextTexture;
gameOverTexture->unload();
delete gameOverTexture;
// Animaciones // Animaciones
for (auto animation : playerAnimations) for (auto animation : playerAnimations)
{ {
@@ -369,6 +373,7 @@ void Game::loadMedia()
gamePowerMeterTexture = new LTexture(renderer, asset->get("game_power_meter.png")); gamePowerMeterTexture = new LTexture(renderer, asset->get("game_power_meter.png"));
gameSkyColorsTexture = new LTexture(renderer, asset->get("game_sky_colors.png")); gameSkyColorsTexture = new LTexture(renderer, asset->get("game_sky_colors.png"));
gameTextTexture = new LTexture(renderer, asset->get("game_text.png")); gameTextTexture = new LTexture(renderer, asset->get("game_text.png"));
gameOverTexture = new LTexture(renderer, asset->get("menu_game_over.png"));
// Texturas - Globos // Texturas - Globos
LTexture *balloon1Texture = new LTexture(renderer, asset->get("balloon1.png")); LTexture *balloon1Texture = new LTexture(renderer, asset->get("balloon1.png"));
@@ -3355,11 +3360,17 @@ void Game::runGameOverScreen()
// Limpia la pantalla // Limpia la pantalla
screen->clean(bgColor); screen->clean(bgColor);
// Dibujo
gameOverSprite->render();
// Dibuja los objetos // Dibuja los objetos
if (numPlayers == 1) if (numPlayers == 1)
{ {
textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 4), lang->getText(43)); // Game Over
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 1), lang->getText(44) + std::to_string(players.at(0)->getScore())); textBig->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 6), lang->getText(43));
// Your Score
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - (BLOCK * 3), lang->getText(44) + std::to_string(players.at(0)->getScore()));
} }
else else
{ {
@@ -3367,7 +3378,8 @@ void Game::runGameOverScreen()
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 12, lang->getText(77) + std::to_string(players.at(0)->getScore())); text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y - 12, lang->getText(77) + std::to_string(players.at(0)->getScore()));
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y, lang->getText(78) + std::to_string(players.at(1)->getScore())); text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y, lang->getText(78) + std::to_string(players.at(1)->getScore()));
} }
text->writeCentered(PLAY_AREA_CENTER_X, PLAY_AREA_CENTER_Y + BLOCK * 2, lang->getText(45)); // Continue?
text->writeCentered(99, PLAY_AREA_CENTER_Y + BLOCK * 2, lang->getText(45));
gameOverMenu->render(); gameOverMenu->render();
fade->render(); fade->render();

View File

@@ -137,6 +137,7 @@ private:
LTexture *gamePowerMeterTexture; // Textura con el marcador de poder de la fase LTexture *gamePowerMeterTexture; // Textura con el marcador de poder de la fase
LTexture *gameSkyColorsTexture; // Textura con los diferentes colores de fondo del juego LTexture *gameSkyColorsTexture; // Textura con los diferentes colores de fondo del juego
LTexture *gameTextTexture; // Textura para los sprites con textos LTexture *gameTextTexture; // Textura para los sprites con textos
LTexture *gameOverTexture; // Textura para la pantalla de game over
std::vector<std::vector<std::string> *> itemAnimations; // Vector con las animaciones de los items std::vector<std::vector<std::string> *> itemAnimations; // Vector con las animaciones de los items
std::vector<std::vector<std::string> *> playerAnimations; // Vector con las animaciones del jugador std::vector<std::vector<std::string> *> playerAnimations; // Vector con las animaciones del jugador
@@ -166,6 +167,7 @@ private:
Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo Sprite *skyColorsSprite; // Sprite con los graficos del degradado de color de fondo
Sprite *grassSprite; // Sprite para la hierba Sprite *grassSprite; // Sprite para la hierba
Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase Sprite *powerMeterSprite; // Sprite para el medidor de poder de la fase
Sprite *gameOverSprite; // Sprite para dibujar los graficos del game over
JA_Sound balloonSound; // Sonido para la explosión del globo JA_Sound balloonSound; // Sonido para la explosión del globo
JA_Sound bulletSound; // Sonido para los disparos JA_Sound bulletSound; // Sonido para los disparos