1. Modify the
OnLayerUpdate
method in theengine
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
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: