HTML and CSS Reference
In-Depth Information
4. The gameView event responds to the process of removing a heart from the game
view, whereas the logic is in charge of determining when the lives run out and the
game is over:
game.deduceLife = function() {
this.lifes -= 1;
if (this.lifes <= 0) {
5. When the game is over, we pause the icker using the following code:
game.gameOver = function() {
Now the game will pause and the boxes will stop falling after three boxes are passed through
the deadline.
Objective complete - mini debriefing
When the game is over, we pause the icker by seing the Ticker.setPaused funcion to
true . Since our game loop depends on the icker, the game loop is paused; thus, no new box
is created and all exising boxes are stopped.
Making the game run again is simply achieved by seing the setPaused Boolean to false .
This is the advantage of having a centralized Ticker that controls everything; everything is
paused with just one Boolean.
Classified intel
Although we know that we are going to use a heart bitmap to represent a life, we are sill
using a rectangular shape. The benefit of using a rectangular shape here is that we can
focus on implemening the logic without switching to the visual creaivity of the brain.
Thinking in both logical as well as visual ways is just too difficult. Once we get to the core
of the working of the gameplay, we can switch to the arisic work of creaing bitmap
graphics for the game elements.
Search WWH ::

Custom Search