forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya muere al caer de alto
This commit is contained in:
@@ -21,6 +21,8 @@ Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Ren
|
||||
onBorder = false;
|
||||
border = BORDER_TOP;
|
||||
invincible = false;
|
||||
alive = true;
|
||||
maxFallHeight = BLOCK * 4;
|
||||
|
||||
jumpIni = ini.jumpIni;
|
||||
state = ini.state;
|
||||
@@ -229,6 +231,10 @@ void Player::checkState()
|
||||
|
||||
else if (state == s_standing)
|
||||
{
|
||||
if (prevState == s_falling && fallCounter > maxFallHeight)
|
||||
{ // Si cae de muy alto, el jugador muere
|
||||
alive = false;
|
||||
}
|
||||
vy = 0.0f;
|
||||
jumpCounter = 0;
|
||||
fallCounter = 0;
|
||||
@@ -652,4 +658,10 @@ void Player::setState(state_e value)
|
||||
{
|
||||
prevState = state;
|
||||
state = value;
|
||||
}
|
||||
|
||||
// Comprueba si el jugador esta vivo
|
||||
bool Player::isAlive()
|
||||
{
|
||||
return alive;
|
||||
}
|
||||
Reference in New Issue
Block a user