Añadido el parametro --invincible

This commit is contained in:
2022-11-02 16:34:31 +01:00
parent 88f419e963
commit c3a82b938f
9 changed files with 47 additions and 40 deletions

View File

@@ -77,6 +77,7 @@ 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
bool infiniteLives; // Indica si el jugador dispone de vidas infinitas
bool invincible; // Indica si el jugador puede morir
};
// Calcula el cuadrado de la distancia entre dos puntos

View File

@@ -86,6 +86,7 @@ void Director::iniOptions()
// Estos valores no se guardan en el fichero de configuraci´ón
options->console = false;
options->infiniteLives = false;
options->invincible = false;
}
// Comprueba los parametros del programa
@@ -106,6 +107,11 @@ void Director::checkProgramArguments(int argc, char *argv[])
{
options->infiniteLives = true;
}
else if (strcmp(argv[i], "--invincible") == 0)
{
options->invincible = true;
}
}
}

View File

@@ -20,9 +20,9 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
// ****
// this->debug->setEnabled(true);
currentRoom = "46.room";
const int x = 0;
const int y = 6;
currentRoom = "27.room";
const int x = 29;
const int y = 13;
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
// ****
@@ -384,7 +384,7 @@ void Game::checkEndGame()
// Mata al jugador
void Game::killPlayer()
{
if (this->player->getInvincible())
if (this->player->getInvincible() || options->invincible)
{
return;
}