8-direction behavior with jump

2

Stats

4,174 visits, 6,968 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 18 Mar, 2012. Last updated 19 Feb, 2019

Introduction

As described at the Fabulous Manual: the the 8 Direction behavior allows an object to be moved up, down, left, right and on diagonals, controlled by the arrow keys by default. It is often useful for controlling the player in a top-down view game.

But what if you want to give your character the ability to jump as the Plataform behavior does?

Solution

This tutorial presents a solution that is not really a trick about programing, it's just a pure animation effect. See image below:

The collision points may be on the shadow. You can make the shadow and the player in different sprites objects and then make the shadow follow the player by a Every tick set position to player image point. Collision also should be configured setting it's correct collision polygon at the Image editor for each jump animation frame, or integrate it in the animation, like the example below:

Click here to play an example. Use ARROWS keys to move and SPACE to jump.

Conclusion

The thing is that it's not really a code of programing the jump to move up and down. The animation make the illusion of jumping.

Credits

This tutorial is result of a forum topic. All credits for this solution, example, image and explanation to SamCartagenaPR. I merely wrote the tutorial.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!