diff --git a/src/player.cpp b/src/player.cpp index e4c316e..871eea0 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -107,9 +107,14 @@ void Player::update(Ground& ground) { velocityX = 0; } - setX(getX() + velocityX); setY(getY() + velocityY); + + //don't go into the ground if a an edge of a pit: + if (grounded || (getY() + getHeight()) < (SCREEN_HEIGHT - 64)) { + setX(getX() + velocityX); + } + if (ground.isTileBelow(getX(), getWidth())) { if (getY() + getHeight() < SCREEN_HEIGHT - 64)