I'm currently in the middle of a game project and came across a problem. Whenever I jump in the game(please try to understand me), the character jumps normally until he hits the floor. When that happens (at the time, he is obviously lower than the floor), he jerks upward to the exact postition of the floor. I know why this happens (the computer checks if his y postion is LOWER than the floor), but I don't know how to fix it. Please help! Here is the code:
if (pc._y<floor && !jumping) {
pc._y += yvel;
if (pc._y>floor) {
pc._y = floor;
yvel = 15;
jumping = false;
if (jumping == true) {
pc._y -= yvel;
yvel -= 2;
if (Key.isDown(Key.UP) && !jumping) {
jumping = true;