SFML community forums
Help => Graphics => Topic started by: rojan_neo on August 20, 2011, 12:14:06 pm
-
I have a bounding box collision detection system setup... It works fine... My problem is while the player is jumping how can i make him fall down when he hits a wall... for eg: in mario when player jumps up and hits a wall with his head he starts falling down from there.. How do I achieve this
-
Your player should have a position and velocity vector, where the latter determines the change in the former per time.
Set the Y component of the velocity vector to zero when the player hits the wall. Gravity continuously increases it, leading to the accelerated fall.
-
yes, I tried that.. and it makes my player fall perfectly but how am I suppose to get the player to jump again after a while because the velocity seems to be 0 for the rest of the game :?: