forked from jaildesigner-jailgames/jaildoctors_dilemma
En la pantalla de Game Over se muestran las habitaciones y los items conseguidos
This commit is contained in:
@@ -86,6 +86,8 @@ struct options_t
|
||||
palette_e palette; // Paleta de colores a usar en el juego
|
||||
bool console; // Indica si ha de mostrar información por la consola de texto
|
||||
cheat_t cheat; // Contiene trucos y ventajas para el juego
|
||||
int rooms; // Cantidad de habitaciones visitadas
|
||||
int items; // Cantidad de items obtenidos
|
||||
};
|
||||
|
||||
// Calcula el cuadrado de la distancia entre dos puntos
|
||||
|
||||
@@ -91,6 +91,8 @@ void Director::iniOptions()
|
||||
options->cheat.invincible = false;
|
||||
options->cheat.jailEnabled = false;
|
||||
options->cheat.altSkin = false;
|
||||
options->rooms = 0;
|
||||
options->items = 0;
|
||||
}
|
||||
|
||||
// Comprueba los parametros del programa
|
||||
|
||||
@@ -340,6 +340,7 @@ bool Game::changeRoom(std::string file)
|
||||
{
|
||||
// Incrementa el contador de habitaciones visitadas
|
||||
board.rooms++;
|
||||
options->rooms = board.rooms;
|
||||
|
||||
// Actualiza las estadisticas
|
||||
stats->addVisit(room->getName());
|
||||
|
||||
@@ -28,9 +28,9 @@ GameOver::GameOver(SDL_Renderer *renderer, Screen *screen, Resource *resource, A
|
||||
iniFade = 310;
|
||||
fadeLenght = 20;
|
||||
playerSprite->setPosX(GAMECANVAS_CENTER_X + 10);
|
||||
playerSprite->setPosY(GAMECANVAS_CENTER_Y + 10);
|
||||
playerSprite->setPosY(GAMECANVAS_CENTER_Y - 10);
|
||||
tvSprite->setPosX(GAMECANVAS_CENTER_X - tvSprite->getAnimationClip(0, 0).w - 10);
|
||||
tvSprite->setPosY(GAMECANVAS_CENTER_Y + 10);
|
||||
tvSprite->setPosY(GAMECANVAS_CENTER_Y - 10);
|
||||
|
||||
// Inicializa el vector de colores
|
||||
const std::vector<std::string> colorList = {"white", "yellow", "cyan", "green", "magenta", "red", "blue", "black"};
|
||||
@@ -86,12 +86,17 @@ void GameOver::render()
|
||||
screen->clean();
|
||||
|
||||
// Escribe el texto de GAME OVER
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y - 20, "G A M E O V E R", 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y - 40, "G A M E O V E R", 1, color);
|
||||
|
||||
// Dibuja los sprites
|
||||
renderSprites();
|
||||
|
||||
// text->write(0, 0, std::to_string(counter));
|
||||
// Escribe el texto con las habitaciones y los items
|
||||
const std::string itemsTxt = std::to_string(options->items / 100) + std::to_string((options->items % 100) / 10) + std::to_string(options->items % 10);
|
||||
const std::string roomsTxt = std::to_string(options->rooms / 100) + std::to_string((options->rooms % 100) / 10) + std::to_string(options->rooms % 10);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y + 40, "ITEMS: " + itemsTxt, 1, color);
|
||||
text->writeDX(TXT_CENTER | TXT_COLOR, GAMECANVAS_CENTER_X, GAMECANVAS_CENTER_Y + 55, "ROOMS: " + roomsTxt, 1, color);
|
||||
|
||||
|
||||
// Vuelca el contenido del renderizador en pantalla
|
||||
screen->blit();
|
||||
@@ -180,7 +185,7 @@ void GameOver::updateColor()
|
||||
|
||||
if (counter < half)
|
||||
{
|
||||
//const float step = std::min(std::max(counter, iniFade) - iniFade, fadeLenght) / (float)fadeLenght;
|
||||
// const float step = std::min(std::max(counter, iniFade) - iniFade, fadeLenght) / (float)fadeLenght;
|
||||
const float step = std::min(counter, fadeLenght) / (float)fadeLenght;
|
||||
const int index = (colors.size() - 1) - int((colors.size() - 1) * step);
|
||||
color = colors.at(index);
|
||||
|
||||
@@ -824,6 +824,7 @@ bool Room::itemCollision(SDL_Rect &rect)
|
||||
items.erase(items.begin() + i);
|
||||
JA_PlaySound(itemSound);
|
||||
*itemsPicked = *itemsPicked + 1;
|
||||
options->items = *itemsPicked;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user