8-direction behavior with jump

  • 22 favourites

Stats

2,415 visits, 4,360 views

Translations

This tutorial hasn't been translated.

Tools

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.

  • 0 Comments

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