 |

 About collectable objects

Beside items, in Dizzy games you may also find other pickable objects.
These don't go into the inventory, but they have various instant effects.
For example, coins, cherries, diamonds or other similar objects are collected and their count is recorded and displayed on the interface.
Sometimes, collecting all of them is required to complete the game, or to receive some bonus outro sequence.
You can also find food objects, that grow your energy bar, or eggs that give you another life credit.
All these are dynamic brushes that have the class property set to coin, food or life.
Collectables objects don't require ids, because they are tested by their class, and the developer has no need to access their properties,
unless the game requires it (like makeing the last coin available, as the result of solving a puzzle).
Start from the default template data and add on the map one coin (tile=210, type=dynamic, class=coin),
one apple (tile=218, type=dynamic, class=food)
and one egg (tile=213, type=dynamic, class=life).
To be able to gain some energy, you must be able to loose some.
Add a collider of an animated flame (type=dynamic, tile=145, id=1000, collider=call handler) and
sets it's class to hurt. The collision handler will deal with it, hurting the player when touching it.
Save the map and run the game. See how these objects work.
|
|
Collectable coins are dynamic brushes with the coin class.
Technically, they are called coins, but the tile can be anything you like: cherries, diamonds, stars, etc.
They don't require an unique brush id, so keep it to 0, unless you must access them.
The total number of collectable coins can be set in the gamedef.gs file,
as the MAXCOINS define. Don't forget to set this define correctly, to the number of coins you placed in your map.
The related messages that are opened when you pick a coin can be found in the action.gs file.
Just search the class_coin text inside this file and edit the text of the messages, to fit your game.
To number of coins collected so far, is stored in the P_COINS property of the player.
To life level is stored in P_LIFE and the credits in P_CREDITS properties.
|
Homework
Add 10 collectable diamonds in the map and set the MAXCOINS define to 10.
Adjust the pick up messages to say about diamonds instead of coins.
Have a character that asks you to collect all the diamonds and return them to him.
Here is a solution for the ActionObject callback of this character.
|
 |