forked from jaildesigner-jailgames/jaildoctors_dilemma
FIx: Al saltar sin parar contra el techo al el jugador moria por caer de muy alto
This commit is contained in:
@@ -196,10 +196,18 @@ void Player::checkInput()
|
||||
|
||||
if (input->checkInput(INPUT_UP, REPEAT_TRUE))
|
||||
{
|
||||
setState(s_jumping);
|
||||
vy = -maxVY;
|
||||
jumpIni = y;
|
||||
jumpCounter = 0;
|
||||
// Solo puede saltar si ademas de estar (state == s_standing)
|
||||
// Esta sobre el suelo, rampa o suelo que se mueve
|
||||
// Esto es para evitar el salto desde el vacio al cambiar de pantalla verticalmente
|
||||
// Ya que se coloca el estado s_standing al cambiar de pantalla
|
||||
|
||||
if (isOnFloor() || isOnAutoSurface())
|
||||
{
|
||||
setState(s_jumping);
|
||||
vy = -maxVY;
|
||||
jumpIni = y;
|
||||
jumpCounter = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,6 +277,7 @@ void Player::checkState()
|
||||
|
||||
else if (state == s_jumping)
|
||||
{
|
||||
fallCounter = 0;
|
||||
jumpCounter++;
|
||||
playJumpSound();
|
||||
}
|
||||
@@ -281,7 +290,6 @@ void Player::switchBorders()
|
||||
{
|
||||
y = PLAY_AREA_BOTTOM - h - 0 - BLOCK;
|
||||
setState(s_standing);
|
||||
// jumpIni += 128;
|
||||
}
|
||||
else if (border == BORDER_BOTTOM)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user