Case Status
Log In


Home » Samples»M2H Jump Game»M2H Jump Game,  jumps Fsm
Community Wiki

M2H Jump Game,  jumps Fsm

Make the player jump every time he touches a platform

the jumping requires some careful thinking before getting it right. We want the player to jump when it is grounded, so we have a state "jump" that add a n upward force to the user to move him up. when that is done we move to the "Is player grounded", this state raycasts downWards no farther than 1 unit and if the raycast hit a platform, we jump again.

This setup requires some delay, because as we apply a force to jump, the user can still be within the one unit range for raycasting, so if we move straight away to the "Is player grounder" state we would detect the player and ask a jump again, so we simply create a "BACK" event and send it from the Jump state with a delay of 0.5 seconds, which enough time for the user to be high enough above the platform it jumped from. We can safely go to the "Is player grounded" and wait for the raycasting to detect a new platform under the player.

When we start, we also want to use to jump, so we call the "JUMP" event, but we do that we a delay of 1 seconds, time for the user to get ready to play and analyze quickly where to go.


Last modified on 5/9/2012 3:15 AM by User.

  • RSS Feed