Hello, I'm having a bit of trouble with getting my character to jump, I've looked around the forums and haven't found a solution to my problem so yeah, here I am :P
So far I have this:
The value of jumpVel is 2; and gravity is 0.2;Code:if(GetAsyncKeyState(VK_SPACE)) person1.jump = true;
if(person1.jump == true){
person1.y += person1.jumpVel;
person1.jumpVel = (person1.jumpVel - person1.gravity);
if(groundCollision()){
person1.jumpVel = person1.oldy;
person1.jump = false;
}
}
That's in my main game loop. The problem is when I hit space the character goes up and doesn't stop, and then the program freezes.
Any help would be most appreciated :).