In the OnUpdateLayer
method, we want to update emitters and enemies. Also we want to check whether all tiles were removed and start the next level. If all lives of the player's ball are gone, we want to display the Game Over text. Follow the given steps:
1. Let's add a check to see if the layer parameter of the method is equal to
layerGame
.Method OnLayerUpdate:Int(layer:ftLayer) If layer = g.layerGame Then
2. Now, do a
FOR EACHIN
loop of the emitter list of thegame
class:For Local emitter := Eachin g.emitterList
3. Check whether a call to the emitter's
Update
method returnsFALSE
. We will use the engine's current delta time as a parameter for the emitter'sUpdate
call. If it is, then the emitter is done and we will remove it from the list:If emitter.Update(g.eng.GetDeltaTime()) = False Then g.emitterList.Remove(emitter) Endif Next
4. Next is a
For EachIn
loop through the enemy list of thegame
class:For Local enemy := Eachin g.enemyList
5...