Time for action — check neighboring vertical tiles

To check the gems vertically, we will use a very similar method.

  1. Just copy the previous method and make the changes according to the marked lines.
    Method CheckGemsY:Int(column:Int, row:Int, gem:Int, mark:Bool=False)
    Local found:Int = 0
    tileMap[column-1][row-1] = -1
    'Check gems on the top
    If row > 1 Then
    For Local r:Int = (row-1) To 1 Step -1
    If tileMap[column-1][r-1] <> gem Then Exit
    If mark Then
    tileMap[column-1][r-1] = 99
    Else
    found += 1
    Endif
    Next
    Endif
    'Check gems on the bottom
    If row < rows Then
    For Local r:Int = (row+1) To rows
    If tileMap[column-1][r-1] <> gem Then Exit
    If mark Then
    tileMap[column-1][r-1] = 99
    Else
    found += 1
    Endif
    Next
    Endif
    If mark Then
    tileMap[column-1][row-1] = 99
    Else
    tileMap[column-1][row-1] = gem
    Endif
    Return found
    End
    

What just happened?

You have created two methods that let you count and mark neighboring tiles/gems. We need these to determine the gems that are matching up in a row or column. Marked gems will be removed later on.

Clearing tiles

Another method we need is one that will delete all the gems that were marked earlier by the two preceding methods we have added.

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

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