To act on timer events, we need to detail the OnObjectTimer
method inside the engine
class. We will set the ID of an object to positive once again, and then check for collisions of its child collision circles:
1. Check whether
timerID
is equal tog.tmObjSwitch
.Method OnObjectTimer:Int(timerId:Int, obj:ftObject) If timerId = g.tmObjSwitch Then
2. Get the object's ID and store it locally in the
id
variable.Local id:Int = obj.GetID()
3. If
id
is negative, set it back to positive.If id < 0 Then obj.SetID(obj.GetID()*-1)
4. Start a
For
loop now, for every child collision circle of the object.For Local i:Int = 1 To obj.GetChildCount()
5. Do a collision check for each collision circle.
g.eng.CollisionCheck(obj.GetChild(i))
6. Close the
For
loop and theIf
check.End Endif Return 0 End End