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())
    cntY = g.CheckGemsY(xp, yp, obj.GetTag())
    
  5. If there is more than one matching gem, call CheckGems again, but this time with an additional True flag to mark the gems or have them removed.
    If cntX>1 Then g.CheckGemsX(xp, yp, obj.GetTag(), True)
    If cntY>1 Then g.CheckGemsY(xp, yp, obj.GetTag(), True)
    Endif
    Return 0
    End
    

What's the situation?… layer update events

At one point of the game you need to check if the game has ended. We do this by comparing the current value of milliseconds to the end time that was set when the game started.

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

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