1
votes

So what i'm trying to do is to apply a filter to an object and then after some time remove it, and what i did is this:

local function _filter(n)
local function reset_filter(n)
 _zombieTable[n].fill.effect = ""
end
 _zombieTable[n].fill.effect = "filter.crystallize"
 transition.to( _zombieTable[n].fill.effect , {time = 200,numTiles = 100} )
 timer.performWithDelay( 300, reset_filter(n),1 )
end

The problem is that the filter it gets applied only if i don't remove it afterwards, which i don't understand because i remove it after 300ms, so it should apply and then dissapear. I also tried with the "onComplete" property of the transition.to but it acts the same.

1
Check how call a function with paramaters using timer.performWithDelay()See two last examples from documentation. - ldurniat

1 Answers

0
votes

This line is the issue: timer.performWithDelay( 300, reset_filter(n),1 )

reset_filter(n) is being called straight away rather than after 300 delay!

Instead it should be : timer.performWithDelay(300, function() reset_filter(n) end, 1)