acabats els nous estats dels jugadors

This commit is contained in:
2024-08-14 14:09:54 +02:00
parent 5c7bb842ec
commit 7e60a742ca
3 changed files with 61 additions and 24 deletions

View File

@@ -20,6 +20,8 @@ Player::Player(float x, int y, std::vector<Texture *> texture, std::vector<std::
// Inicializa variables
// enabled = false;
statusPlaying = PLAYER_STATUS_WAITING;
scoreBoardPanel = 0;
name = "";
init();
}
@@ -542,16 +544,7 @@ void Player::updateContinueCounter()
if (SDL_GetTicks() - continueTicks > ticksSpeed)
{
// Actualiza el contador de ticks
continueTicks = SDL_GetTicks();
// Decrementa el contador
continueCounter--;
if (continueCounter < 0)
{
setStatusPlaying(PLAYER_STATUS_WAITING);
}
decContinueCounter();
}
}
}
@@ -566,4 +559,28 @@ void Player::setScoreBoardPanel(int panel)
int Player::getScoreBoardPanel()
{
return scoreBoardPanel;
}
// Decrementa el contador de continuar
void Player::decContinueCounter()
{
continueTicks = SDL_GetTicks();
continueCounter--;
if (continueCounter < 0)
{
setStatusPlaying(PLAYER_STATUS_WAITING);
}
}
// Establece el nombre del jugador
void Player::setName(std::string name)
{
this->name = name;
}
// Obtiene el nombre del jugador
std::string Player::getName()
{
return name;
}