I have a function which get’s called every one second.
NOTE – Lets say the score update 1 every 2 seconds.
local object = {} local oCounter = 1 local function spawnObject() if score == 0 then timee = 1 elseif score == 5 then timee = 2 end object[oCounter] = display.newImageRect( "image.png", 35, 35 ) object[oCounter].x = centerX object[oCounter].y = centerY object[oCounter].value = oCounter oCounter = oCounter + 1 end dTimer = timer.performWithDelay( 1000, spawnObject, -1 )
So every time the spawnObject function gets called then the if statement gets called. What i want is so the if statement gets called only when the score reaches the next number which is 5 in this case.
Thanks!
–SonicX278