Game Development Reference
In-Depth Information
Performing complex movements with
MotionPaths
Players in games have been obliged to jump on moving platforms since the dawn of gam-
ing. Even with the incredibly advanced games of today, it's not uncommon to encounter
this most primitive game mechanic albeit with better graphics. There's also a popular retro
genre that calls for the same, not the least for mobile games.
How do we do that in jMonkeyEngine? One way is, of course, to simply use move or
setLocalTranslation on geometries. This can quickly get complex if we want to
make sequenced paths. A better option is to use MotionPaths and MotionEvents.
A MotionPath object is basically a set of waypoints through which an object will move
in an interpolated way meaning the movement will be smooth. The MotionEvent is the
control class defining when and how the object should move along the MotionPath ob-
ject. It can define how an object should be rotated along the path and if and how the path
should be cycled through.
In this recipe, we'll check out how to use them for a game, which could be a side-scrolling
2D game, but the same principles can be used to create advanced cinematic cutscenes.
Search WWH ::




Custom Search