Trabajando en el modo pausa
This commit is contained in:
@@ -23,6 +23,7 @@ Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Ren
|
||||
invincible = false;
|
||||
alive = true;
|
||||
maxFallHeight = BLOCK * 4;
|
||||
paused = false;
|
||||
|
||||
jumpIni = ini.jumpIni;
|
||||
state = ini.state;
|
||||
@@ -134,6 +135,11 @@ void Player::render()
|
||||
// Actualiza las variables del objeto
|
||||
void Player::update()
|
||||
{
|
||||
if (paused)
|
||||
{ // Si está en modo pausa no se actualiza nada
|
||||
return;
|
||||
}
|
||||
|
||||
checkInput(); // Comprueba las entradas y modifica variables
|
||||
move(); // Recalcula la posición del jugador
|
||||
animate(); // Establece la animación del jugador
|
||||
@@ -669,4 +675,16 @@ void Player::setState(state_e value)
|
||||
bool Player::isAlive()
|
||||
{
|
||||
return alive;
|
||||
}
|
||||
|
||||
// Pone el jugador en modo pausa
|
||||
void Player::pause()
|
||||
{
|
||||
paused = true;
|
||||
}
|
||||
|
||||
// Quita el modo pausa del jugador
|
||||
void Player::resume()
|
||||
{
|
||||
paused = false;
|
||||
}
|
||||
Reference in New Issue
Block a user