I want to kill a row of gems in a match 3 game. I want to kill the gems Upward in a timed delayed, and the exact same time, kill the gems Downward. The effect would be like the striped gem explodes outward in a shockwave. I thought I could execute both “for” loops at the exact same time? Is it possible?
I called a timer delay function for both “for” loops (code below) : I thought in my mind this would be like making a thread in c++… is it?
To me the code seems to execute each “for” loop seperately…(not at the same time. Just wondering is it possible to execute two for loops at the exact same time?
timer.performWithDelay( 1, function()
for rowToKillDown = row+1 , bubblesMatch3.numRows do
if( rowToKillDown ~= row ) then
timer.performWithDelay( 40*rowToKillDown, function() DestroyGem( col, rowToKillDown ) end)
end
end
end)
timer.performWithDelay( 1, function()
local time_delay = 1
for rowToKillUp = row-1, 0, -1 do
if( rowToKillUp ~= row ) then
timer.performWithDelay( 40*time_delay, function() DestroyGem( col, rowToKillUp ) end)
time_delay = time_delay + 1
end
end
end)