O'Reilly logo

Monkey Game Development by Michael Hartlef

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — detailing the OnObjectTransition method

The OnObjectTransition method is called whenever a transition finishes and this transition had an ID assigned to it. So we will need to act on it:

  1. First, perform a SELECT operation on the transition ID.
    Method OnObjectTransition:Int(transId:Int, obj:ftObject)
    Select transId
    
  2. Check against the tidParticle constant. If it is, the particle needs to be removed. Call the object's Remove method to do this:
    Case g.tidParticle
    obj.Remove()
    
  3. Check against the tidGameOver constant. If it is, activate the title layer:
    Case g.tidGameOver
    g.layerTitle.SetActive(True)
    
  4. Make the Game Over text invisible and scale it back to 1.0:
    g.txtGameOver.SetVisible(False)
    g.txtGameOver.SetScale(1.0)
    
  5. Set the game mode to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required