Game Development Reference
In-Depth Information
Figure 7-4. The treasure chest room
We have the game host in the center of the map, surrounded by his seven chests. Here's what we need to do to
make our treasure chest game:
Come up with a list of rewards that can be obtained. I'll list my seven, but feel free to come up
with your own.
1.
Potion
2.
1 Gold
3.
Elixir
4.
1 Gold (Yes, the player has two chances to get 1 Gold).
5.
Hi-Potion
6.
200 Gold
7.
500 Gold
Add a variable that will store the current “seed” for the treasure chests. We want to
make it so that the contents of a particular chest are one of those seven, on a random
basis. Otherwise, the player can just open the same chest and get the same reward
consistently. A chest's contents will change, based upon the seed value.
Add a switch that will be flipped on while the minigame is in progress and turned off
once it is completed.
Make it so that, once opened, a chest disappears for the duration of the minigame
and reappears afterward.
Have a variable that decreases every time the player opens a chest. We'll set this to
two at the start of the minigame, meaning that the player can open two of the seven
chests present.
Once two chests have been opened, announce that the game is over and reset the
initial starting conditions, so that the player can play again, if he/she so chooses.
Search WWH ::




Custom Search