Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Stencyl Essentials
  • Toc
  • feedback
Stencyl Essentials

Stencyl Essentials

By : Sneyd
4.4 (5)
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
13
Index

Coin collection


Let's start working on the coin collection code. To do so, perform the following steps:

  1. In the Dashboard, under Actor Behaviors, open up the Player Handler.

  2. Click on Attributes toward the bottom-right of the screen, as shown in the following screenshot:

  3. Click on Add Attribute to create our new Score attribute, as shown in the following screenshot:

  4. In the ensuing window, set the Name to Score.

  5. Set Type to Number.

  6. Check Hidden?.

  7. Click on OK to create the attribute.

Now that we've created our Score attribute, we can start writing the code to detect the collisions with Coins, and increment this value accordingly. To accomplish this, perform the following steps:

  1. Navigate to Add Event | Collisions | Actor of Type, as shown in the following screenshot:

  2. Click on the Actor drop-down menu, and select Self, as shown in the following screenshot:

  3. Click on the Actor Type drop-down menu, and select Choose Actor Type.

  4. A list of all the available Actor Types will pop up. Select Coin and click on OK.

  5. The...

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