Time for action – creating a behavior
The game file that needs to be imported and loaded for this session is 5961_04_01.stencyl
.
We are going to use Stencyl's kill… instruction block to remove the collected fruit from the game, remembering that each fruit actor is a member of the Collectibles
group. Execute the following steps in order to create a behavior:
On the Dashboard, under the LOGIC heading, click on Actor Behaviors.
Click on the green Create New button situated at the top of the right-hand panel.
In the Create New… dialog box, enter the words
Collect Fruit
into the Name textbox and click on the Create button.The behavior editor will be displayed.
Click on the + Add Event button at the top of the left-hand panel.
In the pop-up menu that appears, move the mouse over Collisions.
In the next pop-up menu, in the Any actor collides with… section, click on Member of Group.
Double-click on the Actor – Group event label towards the top of the left-hand panel (immediately under the + Add Event button...