To act on timer events, fantomEngine provides the OnObjectTimer
method in the engine
class. We need to modify it.
1. Modify the
OnObjectTimer
method in theengine
class by adding aSelect
statement ontimerId
.Method OnObjectTimer:Int(timerId:Int, obj:ftObject) Select timerId
2. Check for the constant
g.tmShowMenu
. Here, we deal with the automatic switch from the title screen to the menu screen.Case g.tmShowMenu
3. Check if the game mode is
g.gmTitle
, and then activate the menu layer.If g.gameMode = g.gmTitle Then g.gameMode = g.gmMenu g.ActivateLayer(g.gameMode) Endif
4. Check for the constant
g.tmObjRemove
. Here, we deal with deleting the particle objects. After that, close theSelect
statement.Case g.tmObjRemove obj.Remove() End Return 0 End
The OnObjectTimer
method will take care of the title screen's switch to the menu screen and the removing of particles.