Eliminados metodos y variables sobrantes de la clase player

This commit is contained in:
2024-06-30 20:10:10 +02:00
parent eb3cba879a
commit 0d8207013c
4 changed files with 16 additions and 48 deletions

View File

@@ -39,7 +39,6 @@ void Player::init()
posX = defaultPosX;
posY = defaultPosY;
alive = true;
deathCounter = DEATH_COUNTER;
statusWalking = PLAYER_STATUS_WALKING_STOP;
statusFiring = PLAYER_STATUS_FIRING_NO;
invulnerable = true;
@@ -136,7 +135,8 @@ void Player::move()
// Si el jugador abandona el area de juego por los laterales
if ((posX < PLAY_AREA_LEFT - 5) || (posX + width > PLAY_AREA_RIGHT + 5))
{ // Restaura su posición
{
// Restaura su posición
posX -= velX;
}
@@ -159,7 +159,8 @@ void Player::move()
// Si el cadaver abandona el area de juego por los laterales
if ((deathSprite->getPosX() < PLAY_AREA_LEFT) || (deathSprite->getPosX() + width > PLAY_AREA_RIGHT))
{ // Restaura su posición
{
// Restaura su posición
const float vx = deathSprite->getVelX();
deathSprite->setPosX(deathSprite->getPosX() - vx);
@@ -211,7 +212,6 @@ void Player::setWalkingStatus(Uint8 status)
if (statusWalking != status)
{
statusWalking = status;
// legsSprite->setCurrentFrame(0);
}
}
@@ -248,14 +248,16 @@ void Player::setAnimation()
legsSprite->setCurrentAnimation(aWalking);
legsSprite->setFlip(flipWalk);
if (statusFiring == PLAYER_STATUS_FIRING_NO)
{ // No esta disparando
{
// No esta disparando
bodySprite->setCurrentAnimation(aWalking + aBodyCoffees + aPowerUp);
bodySprite->setFlip(flipWalk);
headSprite->setCurrentAnimation(aWalking + aHeadCoffees + aPowerUp);
headSprite->setFlip(flipWalk);
}
else
{ // Está disparando
{
// Está disparando
bodySprite->setCurrentAnimation(aFiring + aBodyCoffees + aPowerUp);
bodySprite->setFlip(flipFire);
headSprite->setCurrentAnimation(aFiring + aHeadCoffees + aPowerUp);
@@ -299,14 +301,7 @@ int Player::getHeight()
bool Player::canFire()
{
// Si el contador a llegado a cero, podemos disparar. En caso contrario decrementamos el contador
if (cooldown > 0)
{
return false;
}
else
{
return true;
}
return cooldown > 0 ? false : true;
}
// Establece el valor de la variable
@@ -341,7 +336,6 @@ void Player::update()
updateCooldown();
updatePowerUpCounter();
updateInvulnerableCounter();
updateDeathCounter();
updatePowerUpHeadOffset();
}
@@ -467,18 +461,6 @@ void Player::updateInvulnerableCounter()
}
}
// Actualiza el valor de la variable
void Player::updateDeathCounter()
{
if (!alive)
{
if (deathCounter > 0)
{
deathCounter--;
}
}
}
// Obtiene el valor de la variable
bool Player::isPowerUp()
{
@@ -584,13 +566,6 @@ void Player::shiftColliders()
Texture *Player::getDeadTexture()
{
return deathSprite->getTexture();
;
}
// Obtiene el valor de la variable
Uint16 Player::getDeathCounter()
{
return deathCounter;
}
// Actualiza el valor de la variable