Time for action — enhancing the OnObjectTimer method

The OnObjectTimer method of the engine class needs to be detailed. For the bullets, the canShoot field of the game class needs to be set to TRUE and they also need to be deleted.

  1. Check whether the timer ID is equal to g.tmDelete. If yes, call the Remove method of the object.
    Method OnObjectTimer:Int(timerId:Int, obj:ftObject)
    If timerId = g.tmDelete Then obj.Remove()
    
  2. Check whether the timer ID is equal to g.canShoot. If yes, set g.canShoot to True.
    If timerId = g.tmCanShoot Then g.canShoot = True
    Return 0
    End
    

What just happened?

Enhancing the OnObjectTimer method will let you delete objects and set the canShoot field of the game class to True, so the enemy plane can spawn bullets again.

It is gone!—a transition is done

All particles are controlled by transitions. That is why you need to detail the OnObjectTransition method of the engine class.

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

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