5 The time of your life



Timelines, Lifes, Scores, Timers

Counting Lifes

Counting lifes is a simple way to keep track of how many times the player can lose a game. We can do this by using a variable that is decremented each time the player loses a life.


    
  

Making Levels

We learned a basic way to make levels by using arrays. If we don't limit our data structure to 0 and 1 we can build more complex levels.

Another approach to use invisible elements that overlay the background game art. This way we can create more complex and fine-grained levels.


    
  

Making a highscore and saving it in a file

We can save the highscore in a file by using the localStorage object. This way we can save the highscore even if the player closes the browser.

 
    
  

Using timers and counters to trigger events and enemies

We can use timers and counters to trigger events and enemies. This way we can create more dynamic and engaging games.