Programming the button
Great! Now that we have created and configured the Play Game Button, we must write an Actor Behavior that will cause it to behave like a button by reacting to the mouse's events. To do so, perform the following steps:
- Go to the Dashboard tab, select Actor Behaviors, and click on Create New.
- In the ensuing window, set Name to
Play Button Handler
, and click on Create. - Navigate to Add Event | Input | On Actor, as shown in the following screenshot:
- Switch the condition from enters to is pressed on, as shown in the following screenshot:
- In the blocks palette, navigate to Scene | Game Flow | Transitions, drag out and add a switch to ...
Get Stencyl Essentials now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.