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 detailed as follows:

  1. Modify the OnObjectTransition method of the engine class. Insert a local pair of position variables and a pair of counting variables.
    Method OnObjectTransition:Int(transId:Int, obj:ftObject)
    Local xp:Int
    Local yp:Int
    Local cntX:Int
    Local cntY:Int
    
  2. Check if the transition ID is equal to 99, and if so, get the x and y positions of the slot from the calling object.
    If transId = 99 Then
    xp = g.GetSlotX(obj)
    yp = g.GetSlotY(obj)
    
  3. Now, set the slot tile with the tag value of the object.
    g.SetSlotTile(xp, yp, obj.GetTag())
    
  4. Determine the count. How many gems match at the given row and column of the object?
    cntX = g.CheckGemsX(xp, yp, obj.GetTag()) ...

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