Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Stencyl Essentials
  • Table Of Contents Toc
  • Feedback & Rating feedback
Stencyl Essentials

Stencyl Essentials

By : Sneyd
4.4 (5)
close
close
Stencyl Essentials

Stencyl Essentials

4.4 (5)
By: Sneyd

Overview of this book

If you are a computer game enthusiast who has always wanted to know what it takes to build a playable game, or maybe you would like to expand your programming knowledge so that you can develop great computer games using a solid game engine and toolkit, then this book is for you.
Table of Contents (14 chapters)
close
close
13
Index

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:

  1. Go to the Dashboard tab, select Actor Behaviors, and click on Create New.

  2. In the ensuing window, set Name to Play Button Handler, and click on Create.

  3. Navigate to Add Event | Input | On Actor, as shown in the following screenshot:

  4. Switch the condition from enters to is pressed on, as shown in the following screenshot:

  5. In the blocks palette, navigate to Scene | Game Flow | Transitions, drag out and add a switch to Scene and Crossfade block, as shown in the following screenshot:

  6. Click on the Scene field, and select Choose Scene, as shown in the following screenshot:

  7. A window will appear, displaying all of the available scenes. Select Level 1, and click on OK.

  8. Set for secs to 1, as shown in the following screenshot:

  9. Click on Attach to Actor Type, and select Play...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY