Hi gurus,
I am creating a board game (drag-select-break)
Basically when i first start, the function work well
Here my code
local function delayBreak(block)
print(‘line 388 call delayBreak(block)’)
block:breakme()
– remove from instance array
GTK.TILE_INSTANCES[block.id] = nil
end
for k in pairs (GTK.TILE_COLLECTIVE) do
local block = GTK.TILE_COLLECTIVE[k]
print(‘looping block.id =’ … block.id)local closure = function() return delayBreak(GTK.TILE_COLLECTIVE[k]) end
local closure2 = function() return delaySpawn(GTK.TILE_COLLECTIVE[k]) end– delay block break
BOARD.TIMER.BREAK = timer.performWithDelay(delayTime, closure, 1)
BOARD.TIMER.SPAWN = timer.performWithDelay(delayTime + 200, closure2, 1)– Increase break timer
delayTime = delayTime + delayIncrend
These code basically to delay the break & respawn of the blocks collected (GTK.TILE_COLLECTIVE).
In my first level, it work fine. But when i come to second level (scene.reload)
When i drag-select 3 blocks, the timer.performWithDelay function run TWICE…???
Here my log file
looping block.id =74
looping block.id =75
looping block.id =76
line 388 call delayBreak(block)
call BLOCK:destroy()
self.name = RED2 id = 74
line 388 call delayBreak(block)
call BLOCK:destroy()
self.name = RED2 id = 74
line 388 call delayBreak(block)
call BLOCK:destroy()
self.name = RED2 id = 75
line 388 call delayBreak(block)
call BLOCK:destroy()
self.name = RED2 id = 75
line 388 call delayBreak(block)
call BLOCK:destroy()
self.name = RED2 id = 76
line 388 call delayBreak(block)
call BLOCK:destroy()
self.name = RED2 id = 76
i tried debug a few days but have no clue… is it some kinda bug?
Can any gurus provide some pointer?
Thanks for your patient on my bad english.
Regards,
Weilies