Game Development Reference
In-Depth Information
Now let's create some coins throughout the level that the player can collect. We can
create a marketplace at the end of each level where you can spend your points.
We will now edit Kevin. Let's create a new
Rule
, and change it to
Actor receives
event
|
overlaps or collides
|
with actor of type
|
coin
, then drag in a Change
Attribute and change it to
Change Attribute:
game.Score
|
to:
|
game.Score + 10
.
This way, whenever Kevin collides with a coin, it will add to the score. Now we have
to edit the
Coin
actor. Simply create a new rule, change it to
Actor receives event
|
overlaps or collides
|
with actor of type
|
Kevin
, then drag in a
Destroy
behavior.
If you want to, you can also make a quick animation, like the coin glittering when it
disappears (like in Sonic).
Now that we have the scoring completed for the moment, let's work on saving the
level we are on, and let's save the score as well.
There are two different ways we can save attributes. One way is by simply using the
Save Attribute
behavior. However, after some research, it does not seem to be the
most reliable way to save information.