Game Development Reference
In-Depth Information
Then you add one line of code to update the value of the variable depending on the current tile the
player is standing on:
this.walkingOnHot = this.walkingOnHot || currentTile.hot;
For the complete code, see the Player class belonging to the TickTickFinal example.
Using the walkingOnIce and walkingOnHot variables, you can now update the timer multiplier. You do
this in the player's update method:
var timer = this.root.find(ID.timer);
if (this.walkingOnHot)
timer.multiplier = 2;
else if (this.walkingOnIce)
timer.multiplier = 0.5;
else
timer.multiplier = 1;
From a game design perspective, it's probably a good idea to explicitly let the player know that
walking on a hot tile shortens the time left for finishing the level. You can do this by briefly showing
a warning overlay or changing the timer's display color. You can also play back a warning sound.
Another possibility would be to change the background music to something more frantic, to make
the player realize something has changed.
ADAPTING TO THE SKILLS OF THE PLAYER
Changing the speed of the timer can make a level much easier or harder. You could extend the game so that in some
cases the timer would stop or would move back a few seconds if the player picked up a special item. You could even
make the level progression adaptive so that if the player dies too often, the maximum time of 30 seconds per level is
increased. However, be careful about doing this. If you help the player in a too-obvious way, the player will realize it and
adapt their strategy to it (in other words, the player will play worse in order to make the levels easier). Also, the player
may feel they aren't being treated seriously. A better way to deal with adapting the maximum time per level is to allow
the player to (partly) transfer time left over from previous levels to the current level. That way, difficult levels can be made
easier, but the player has to do something to make that happen. You could also consider adding difficulty levels, where a
more difficult level has a faster timer but also better benefits such as more points, extra items to pick up, or extra abilities
for the player. Casual game players can then select the “Can I play, Daddy?” difficulty level, whereas skilled players can
opt for the extremely challenging “I am Death incarnate” level.
When the Timer Reaches Zero
When the player doesn't finish the level on time, the bomb explodes, and the game is over. A Boolean
member variable in the Player class indicates whether the player has exploded. You then add a
method called explode to the class that sets the explosion in motion. This is the complete method:
Player.prototype.explode = function () {
if (!this.alive || this.finished)
return;
this.alive = false;
 
Search WWH ::




Custom Search