El jugador ya reaparece en su posición original
This commit is contained in:
@@ -2931,6 +2931,10 @@ void Game::checkGameInput()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (input->checkInput(input_accept, REPEAT_TRUE, options->game.input[i].deviceType, options->game.input[i].id))
|
||||||
|
{
|
||||||
|
player->init();
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ Player::Player(float x, int y, SDL_Renderer *renderer, std::vector<Texture *> te
|
|||||||
fireSprite->getTexture()->setAlpha(224);
|
fireSprite->getTexture()->setAlpha(224);
|
||||||
|
|
||||||
// Establece la posición inicial del jugador
|
// Establece la posición inicial del jugador
|
||||||
posX = x;
|
defaultPosX = posX = x;
|
||||||
posY = y;
|
defaultPosY = posY = y;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@@ -36,11 +36,13 @@ Player::~Player()
|
|||||||
void Player::init()
|
void Player::init()
|
||||||
{
|
{
|
||||||
// Inicializa variables de estado
|
// Inicializa variables de estado
|
||||||
|
posX = defaultPosX;
|
||||||
|
posY = defaultPosY;
|
||||||
alive = true;
|
alive = true;
|
||||||
deathCounter = DEATH_COUNTER;
|
deathCounter = DEATH_COUNTER;
|
||||||
statusWalking = PLAYER_STATUS_WALKING_STOP;
|
statusWalking = PLAYER_STATUS_WALKING_STOP;
|
||||||
statusFiring = PLAYER_STATUS_FIRING_NO;
|
statusFiring = PLAYER_STATUS_FIRING_NO;
|
||||||
invulnerable = false;
|
invulnerable = true;
|
||||||
invulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
|
invulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
|
||||||
powerUp = false;
|
powerUp = false;
|
||||||
powerUpCounter = PLAYER_POWERUP_COUNTER;
|
powerUpCounter = PLAYER_POWERUP_COUNTER;
|
||||||
|
|||||||
@@ -37,12 +37,15 @@ private:
|
|||||||
AnimatedSprite *bodySprite; // Sprite para dibujar el cuerpo
|
AnimatedSprite *bodySprite; // Sprite para dibujar el cuerpo
|
||||||
AnimatedSprite *legsSprite; // Sprite para dibujar las piernas
|
AnimatedSprite *legsSprite; // Sprite para dibujar las piernas
|
||||||
AnimatedSprite *deathSprite; // Sprite para dibujar el jugador derrotado
|
AnimatedSprite *deathSprite; // Sprite para dibujar el jugador derrotado
|
||||||
AnimatedSprite *fireSprite; // Sprite para dibujar el aura del jugador con el poder a tope
|
AnimatedSprite *fireSprite; // Sprite para dibujar el aura del jugador con el poder a tope
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
float posX; // Posicion en el eje X
|
float posX; // Posicion en el eje X
|
||||||
int posY; // Posicion en el eje Y
|
int posY; // Posicion en el eje Y
|
||||||
|
|
||||||
|
float defaultPosX; // Posición inicial para el jugador
|
||||||
|
int defaultPosY; // Posición inicial para el jugador
|
||||||
|
|
||||||
Uint8 width; // Anchura
|
Uint8 width; // Anchura
|
||||||
Uint8 height; // Altura
|
Uint8 height; // Altura
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user