Coin collection
Let's start working on the coin collection code. To do so, perform the following steps:
- In the Dashboard, under Actor Behaviors, open up the Player Handler.
- Click on Attributes toward the bottom-right of the screen, as shown in the following screenshot:
- Click on Add Attribute to create our new Score attribute, as shown in the following screenshot:
- In the ensuing window, set the Name to
Score
. - Set Type to Number.
- Check Hidden?.
- 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:
- Navigate to Add Event | Collisions | Actor of Type, as shown in the following screenshot:
- Click on the Actor drop-down menu, and select Self, as shown in the following screenshot:
- Click on the Actor Type drop-down menu, and select Choose Actor Type.
- A list of all the available Actor Types will pop up. Select Coin and click...