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 gmMenu and end the SELECT statement:
    g.gameMode = g.gmMenu
    End
    Return 0
    End
    

What just happened?

The code in the OnObjectMethod made sure that we removed the particles once they reached their destination and also switched the game back to the title screen once the Game Over text was scaled to its final size.

So what is left? Not much. Collision checks should come to mind, as the goal is to destroy the tiles.

Bump bump—checking for collisions

Every time you call the engine's CollisionCheck method, for each collision that has happened, the engines OnObjectCollision method is called with both objects as parameters.

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

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