Time for action — acting on layer update events

  1. Modify the OnLayerUpdate method in the engine class.
    Method OnLayerUpdate:Int(layer:ftLayer)
    
  2. Check if the game mode is equal to g.gmPlay.
    If g.gameMode = g.gmPlay Then
    
  3. Check if the end time is equal to or smaller than the current Millisecs value. If yes, that means the game time ran out and you must show the 'game over' screen.
    If g.endTime <= Millisecs() Then
    g.ShowGameOver()
    
  4. Add the last score to the score list, and save the high-score list.
    g.eng.scoreList.AddScore(g.score,"---")
    g.SaveHighScore()
    
  5. Close the last two IF checks.
    Endif
    Endif
    Return 0
    End
    End
    

What just happened?

Because we now act on the fact that the time ran out, we can finally play the full game. If everything builds well, you could see this:

What just happened?

Have a go hero — enhancing Treasure Chest

Again, there are things that were left out of the game. For example, an option screen, or a way to remove gems, sounds, effects, and other things, too. Also, you could add some bonus gems that give you extra time. You see, the possibilities are many. Have fun digging through the code, and create YOUR version of Treasure Chest.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.68.28