RedMonkey tutorial

RedMonkey has reached a decent level of usability, so I’m here to make the first tutorial! :tada:

For a quick introduction, have a look at my previous post.

Here we go! :sunglasses:

First of all, we attach the RedMonkeyAppState.

Now we add a Banana. After setting up a Spatial and a RigidBody, we define a Banana as RMItem and we attach the semantical tags “Banana” and “Tasty”. So far, so good. But having only bananas around won’t make our game very interesting… let’s put a Red Monkey inside!

RedMonkey extends RMItem in several ways and requires a lot of stuff: Spatial, Animation, CharacterControl… and a Sense.
The Sense is the only way to make a RedMonkey aware of its surroundings in the RedMonkey space. In this case, for the sake of simplicity, we are adding a RMOmniSight: a sight that can see everything so that no bananas will go unnoticed).

Also, we are setting the Behavior Tree which basically contains the AI logic of RedMonkey.
The Behavior Tree implementation is built on top of gdx-ai made by @davebaol , so check out the wiki to better understand them.

But back to our RedMonkey, here is the script:

First of all, the “sense” task looks around for RMItems tagged “Tasty Banana”. A “Rotten Banana” or a plain
“Banana” will be ignored.
Then the “goto” task will move the RedMonkey toward the aforementioned Tasty Banana (if no Banana are found, then the sequence will fail and goto will not be executed).
Goto specify the animation, the speed at which the RedMonkey walks and the “reaching distance” (if the distance between the RedMonkey and Banana is bigger, then the Banana isn’t reached yet).
The Eat task just runs an animation and finishes when the animation is cycled once.

Well, we have covered the basics of RedMonkey and I haven’t even mentioned the Interruption (which is another core concept of RedMonkey). Oh well, until next time, have fun with it and feel free to comment.
Thanks for reading! :sunglasses: