I want to make a match 3 destroy function like this game
https://www.youtube.com/watch?v=8Fnqg_vw094
I have no idea how to do that , is there any tutorial about Math 3 destroy function ?
local arr = {{0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0}, {0,0,0},} local text = {} local block = {} for i = 1 , 3 do text[i] = {} for j = 1 , 7 do text[i][j] = display.newText(arr[j][i], 100, 330, "",20) text[i][j].x = i \* 22 text[i][j].y = j\*22 end end num = 1 function newBlock() block[num] = display.newRect(0,0,40,40) block[num].x = 160 block[num].y = 100 block[num].id = 1 block[num].id2 = 2 block[num]:setFillColor(0.9,0.4,0.9) move(block[num]) end function move(obj) if obj.id \< 7 then if arr[obj.id+1][obj.id2] == 0 then obj.id = obj.id + 1 transition.to(obj,{time = 300 , y = obj.y + 41 , onComplete = function(self) local function move2() move(obj) end timer.performWithDelay(250,move2,1) end}) elseif obj.id-1 \> 0 then arr[obj.id][obj.id2] = 1 obj.id = 1 obj.id2 = 1 for i = 1 , 3 do for j = 1 , 7 do text[i][j].text = arr[j][i] end end newBlock() else arr[obj.id][obj.id2] = 1 obj.id = 1 obj.id2 = 1 for i = 1 , 3 do for j = 1 ,7 do text[i][j].text = arr[j][i] end end end else arr[obj.id][obj.id2] = 1 obj.id = obj.newId obj.id2 = 3 for i = 1 , 3 do for j = 1 ,7 do text[i][j].text = arr[j][i] end end newBlock() end end newBlock()