Time for action — detailing the OnObjectTransition method

We will use this method to fire a timer that will switch the ID of an object. The ID is important for our collision checks. As we don't want to check the collision right away, we use a timer for a little delay:

  1. Inside the OnObjectTransition method, create an object timer with the game's tmObjSwitch constants. It should fire in 100 milliseconds:
    Method OnObjectTransition:Int(transId:Int, obj:ftObject)
    g.eng.CreateObjTimer(obj, g.tmObjSwitch, 100)
    Return 0
    End
    

What just happened?

Since we don't want to check for collisions of the atom elements' connectors right away, we fire an object timer to do this with a little delay.

It's about time—timer events

Whenever a timer event fires, you want to act on it. If you don't, then it makes no sense to fire it in the first place, or does it?

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

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