Animatedsprite ya no permite indices fuera de rango

This commit is contained in:
2022-09-25 13:00:39 +02:00
parent 66840ebf11
commit 8a4d2a541d
18 changed files with 79 additions and 71 deletions

View File

@@ -18,17 +18,17 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, D
// ****
// this->debug->setEnabled(true);
//currentRoom = "11.room";
//spawnPoint = {2 * 8, 5 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
// currentRoom = "11.room";
// spawnPoint = {2 * 8, 5 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
//currentRoom = "06.room";
//spawnPoint = {14 * 8, 9 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
// currentRoom = "06.room";
// spawnPoint = {14 * 8, 9 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
//currentRoom = "60.room";
//const int x = 16;
//const int y = 13;
//spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
// ****
// currentRoom = "60.room";
// const int x = 16;
// const int y = 13;
// spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
// ****
// Crea los objetos
scoreboard = new ScoreBoard(renderer, asset, &board);
@@ -320,7 +320,7 @@ bool Game::changeRoom(std::string file)
board.color = (c.r + c.g + c.b == 0) ? stringToColor("white") : c; // Si el color es negrom cambialo a blanco
if (roomTracker->addRoom(file))
{ // Incrementa el contador de habitaciones visitadas
++board.rooms;
board.rooms++;
}
// Pasa la nueva habitación al jugador
@@ -422,7 +422,7 @@ void Game::reLoadTextures()
void Game::setBlackScreen()
{
blackScreen = true;
//screen->setspectrumFade();
// screen->setspectrumFade();
}
// Actualiza las variables relativas a la pantalla en negro
@@ -430,18 +430,15 @@ void Game::updateBlackScreen()
{
if (blackScreen)
{
//if (screen->spectrumFadeEnded())
blackScreenCounter++;
if (blackScreenCounter > 10)
{
++blackScreenCounter;
if (blackScreenCounter > 10)
{
blackScreen = false;
blackScreenCounter = 0;
blackScreen = false;
blackScreenCounter = 0;
player->resume();
room->resume();
screen->setBorderColor(room->getBorderColor());
}
player->resume();
room->resume();
screen->setBorderColor(room->getBorderColor());
}
}
}