El jugador ya reaparece en su posición original
This commit is contained in:
@@ -2931,6 +2931,10 @@ void Game::checkGameInput()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (input->checkInput(input_accept, REPEAT_TRUE, options->game.input[i].deviceType, options->game.input[i].id))
|
||||
{
|
||||
player->init();
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ Player::Player(float x, int y, SDL_Renderer *renderer, std::vector<Texture *> te
|
||||
fireSprite->getTexture()->setAlpha(224);
|
||||
|
||||
// Establece la posición inicial del jugador
|
||||
posX = x;
|
||||
posY = y;
|
||||
defaultPosX = posX = x;
|
||||
defaultPosY = posY = y;
|
||||
|
||||
init();
|
||||
}
|
||||
@@ -36,11 +36,13 @@ Player::~Player()
|
||||
void Player::init()
|
||||
{
|
||||
// Inicializa variables de estado
|
||||
posX = defaultPosX;
|
||||
posY = defaultPosY;
|
||||
alive = true;
|
||||
deathCounter = DEATH_COUNTER;
|
||||
statusWalking = PLAYER_STATUS_WALKING_STOP;
|
||||
statusFiring = PLAYER_STATUS_FIRING_NO;
|
||||
invulnerable = false;
|
||||
invulnerable = true;
|
||||
invulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
|
||||
powerUp = false;
|
||||
powerUpCounter = PLAYER_POWERUP_COUNTER;
|
||||
|
||||
@@ -43,6 +43,9 @@ private:
|
||||
float posX; // Posicion en el eje X
|
||||
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 height; // Altura
|
||||
|
||||
|
||||
Reference in New Issue
Block a user