When a player touches a ground peice in a game, he seems to sink through the ground then slowly rise back up, and when he has risen back up, he is very jittery.
if (touchingTheGround())
{
player.velocity.Y -= 2;
touchground = false;
}
the collision method sets the variable touchground to true if the player touches a ground peice, and if i dont set it to false, the collision detection wont work at all. i set the players velocity to move 2 up because when he's not touching a platform, his velocity.Y += 1. How do i achieve a way so that the player
- Does not sink in the ground before moving up
- Stops jittering when its position is higher than the ground its touching