FIx: Al saltar sin parar contra el techo al el jugador moria por caer de muy alto
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ thumbs.db
|
|||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zip
|
*.zip
|
||||||
*.app
|
*.app
|
||||||
|
*_debug
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
16,16,16,16,16,0,16,16,16,16,349,349,349,349,349,349,349,349,349,349,302,0,0,302,302,16,16,16,16,16,16,16,
|
16,16,16,16,16,0,16,16,16,16,349,349,349,349,349,349,349,349,349,349,302,0,0,302,302,16,16,16,16,16,16,16,
|
||||||
16,16,0,0,0,0,0,349,16,349,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,
|
16,16,0,0,0,0,0,349,16,349,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,
|
||||||
16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,
|
16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,
|
||||||
16,0,0,0,0,349,0,0,16,0,0,0,0,0,0,0,0,0,0,0,423,423,423,423,423,0,0,0,0,0,0,16,
|
16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,423,423,423,423,423,0,0,0,0,0,0,16,
|
||||||
16,0,0,0,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,
|
16,0,0,0,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,
|
||||||
16,0,0,0,0,0,0,16,16,16,16,0,0,0,423,0,0,0,423,547,0,0,0,0,0,0,0,0,0,0,0,16,
|
16,0,0,0,0,0,0,16,16,16,16,0,0,0,423,0,0,0,423,547,0,0,0,0,0,0,0,0,0,0,0,16,
|
||||||
16,0,0,0,0,0,0,0,16,16,0,0,0,0,0,0,0,0,0,0,547,0,0,0,0,424,422,424,422,0,0,16,
|
16,0,0,0,0,0,0,0,16,16,0,0,0,0,0,0,0,0,0,0,547,0,0,0,0,424,422,424,422,0,0,16,
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
|
|||||||
this->options = options;
|
this->options = options;
|
||||||
|
|
||||||
#ifndef RELEASE
|
#ifndef RELEASE
|
||||||
currentRoom = "33.room";
|
currentRoom = "14.room";
|
||||||
const int x1 = 1;
|
const int x1 = 1;
|
||||||
const int y1 = 13;
|
const int y1 = 13;
|
||||||
spawnPoint = {x1 * 8, y1 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
spawnPoint = {x1 * 8, y1 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||||
|
|||||||
@@ -195,6 +195,13 @@ void Player::checkInput()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (input->checkInput(INPUT_UP, REPEAT_TRUE))
|
if (input->checkInput(INPUT_UP, REPEAT_TRUE))
|
||||||
|
{
|
||||||
|
// 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);
|
setState(s_jumping);
|
||||||
vy = -maxVY;
|
vy = -maxVY;
|
||||||
@@ -202,6 +209,7 @@ void Player::checkInput()
|
|||||||
jumpCounter = 0;
|
jumpCounter = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Indica si el jugador esta en uno de los cuatro bordes de la pantalla
|
// Indica si el jugador esta en uno de los cuatro bordes de la pantalla
|
||||||
bool Player::getOnBorder()
|
bool Player::getOnBorder()
|
||||||
@@ -269,6 +277,7 @@ void Player::checkState()
|
|||||||
|
|
||||||
else if (state == s_jumping)
|
else if (state == s_jumping)
|
||||||
{
|
{
|
||||||
|
fallCounter = 0;
|
||||||
jumpCounter++;
|
jumpCounter++;
|
||||||
playJumpSound();
|
playJumpSound();
|
||||||
}
|
}
|
||||||
@@ -281,7 +290,6 @@ void Player::switchBorders()
|
|||||||
{
|
{
|
||||||
y = PLAY_AREA_BOTTOM - h - 0 - BLOCK;
|
y = PLAY_AREA_BOTTOM - h - 0 - BLOCK;
|
||||||
setState(s_standing);
|
setState(s_standing);
|
||||||
// jumpIni += 128;
|
|
||||||
}
|
}
|
||||||
else if (border == BORDER_BOTTOM)
|
else if (border == BORDER_BOTTOM)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user