before change player animation

This commit is contained in:
2021-02-26 22:48:52 +01:00
parent 765b64c29c
commit a3e608b01e
6 changed files with 81 additions and 60 deletions

View File

@@ -32,6 +32,7 @@ void Player::init(float x, int y, LTexture *textureLegs, LTexture *textureBody,
mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
mExtraHit = false;
mCoffees = 0;
mInput = true;
// Establece la altura y el ancho del jugador
mWidth = 3 * BLOCK;
@@ -726,16 +727,40 @@ bool Player::hasExtraHit()
void Player::giveExtraHit()
{
mExtraHit = true;
mCoffees++;
if (mCoffees > 2)
mCoffees = 2;
}
// Quita el toque extra al jugador
void Player::removeExtraHit()
{
mExtraHit = false;
if (mCoffees > 0)
mCoffees--;
if (mCoffees == 0)
mExtraHit = false;
mInvulnerable = true;
mInvulnerableCounter = PLAYER_INVULNERABLE_COUNTER;
}
// Habilita la entrada de ordenes
void Player::enableInput()
{
mInput = true;
}
// Deshabilita la entrada de ordenes
void Player::disableInput()
{
mInput = false;
}
// Devuelve el numero de cafes actuales
Uint8 Player::getCoffees()
{
return mCoffees;
}
// Obtiene el circulo de colisión
Circle &Player::getCollider()
{