Precise Jumps

Published December 12, 2015
Advertisement

This morning, I've just finished up implementing old TombRaider style precise jumps in the game.

Now, if you press jump, you hop on the spot. If, after pressing jump, you immediately press whatever forward is with respect to the camera, you hop a fixed distance forward. If you are running and you hold down jump, next time both feet are on the ground you jump forward twice as far. All jumping is fixed regardless of what happens with the keys after the jump is initiated.

Jumping from idle does a quick BeginJump state first, where his knees bend and this is effectively the window to press the forward key.

You can also now to a backwards hop by pressing jump followed by whatever the backward direction is and have made a small animation for this where he bends his shoulders and head backwards. This backwards hop moves you exactly the right amount backwards to be able to run and jump from whatever point you were at, so it is the classic TombRaider walk to edge, backwards hop, run and jump mechanic I loved so much. I do this a couple of times in the video.

It is a bit too easy to accidentally run off an edge at the moment, so I think I'm going to all a small, half-second delay for going from idle to running.

But so far, the overall structure and design of the state machine is allowing for implementing stuff like the above quite painlessly. The states enter() and leave() system allow for the forwardVelocity to be passed from JumpState into FallState quite cleanly and I can lengthen the BeginJump state if I want to give the player more time to press the direction key after the jump key.

Using the animation events to decide when, while running, a jump can be initiated seems to work well as well, since this is the logical place to define these points. You can mark any frame point to fire an event in the model editor which translates via some pipework into an animationEvent() being called on the current state, so switching from jump any time, to jump at certain points in the animation was just a case of moving the jump check from update() to animationEvent() in the RunState class.

Air controls are now gone during jumping and falling. I might re-introduce them at some point, but they will be working in a very different way to how they were. No more completely spinning direction while in the air since it is highly unrealistic and unpredictable.

So, some progress, albeit bit by bit. Thanks, as usual, for stopping by.

12 likes 3 comments

Comments

clownman

cool!

December 16, 2015 05:52 PM
cozzie
Nice
December 16, 2015 09:55 PM
Aardvajk
Thanks guys
December 23, 2015 12:05 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement