Tuesday, 15 April 2014

Stencyl actor behaviour tutorials.

Actor behaviors requires building a custom behavior like following actor and applying it's own events. These behaviors can then be applied to the actor, who will act on those behaviors and can be applied to more than one actor. This will require a couple of tutorials which the first one is:

 https://www.youtube.com/watch?v=vslD_SxxvXM

The next tutorial will be from the "Learning Stencyl 3.X Game Development" textbook. This book has activities to work through and one is behaviors.
Okay I worked through the first two parts of chapter 4 which is about creating behaviors. First thing was to create a custom behavior called collide with collectibles. This enabled the actor to make a collectible fruit disappear when collided with. You have to create the actor behavior, go into the event option which is also the behavior editor.
Next add an event which is the one under the collisions, in any actor collides with and find member of group. Also change the name to collides with collectibles.
A block will appear called when actor hits a...You have to find in the center panel, the actor group selector which you choose an actor group from the list. In this case is the collectibles.
Next you go to the actor button in the instruction block palette at the top of the right-hand panel. Click on the properties panel and go down to kill self block in the Alive/Dead subcategory.You then drag this block to the space in the orange center panel. Locate the blue of group at the top-right of the orange self hits block and drag it into the word self in the blue kill self block.
Finally click on the green attach to actor type button at the top-right of the block palette and pick the monkey in the choose actor type dialogue box. Now test the game to see if it's working.
This demonstrates how to start a custom character behavior and add events in the behavior editor. I actually went a little further in the tutorial and added an event where the actor will die if colliding with an enemy which works similar to colliding with collectibles.


No comments:

Post a Comment