So I’m learning programming and trying to create a simple game for the start.
My game (yet) is: balloon is flying from bottom to top and when you click the balloon it bursts.
But after balloon explodes I want to make appear an image that looks similar to exploded firework or something like that. I want to do this to make explosion look more lively and realistic.
I can make timer work when I type this at the bottom of my code.
timer.performWithDelay( 500, destroy\_blurp, 1)
^This code says to destroy ‘blurp’ (that’s how I called the fireworks-explosion image) image after half of a second
This way timer starts counting when the app is launched. That’s not what I want. I want that timer would start counting after I click the balloon.
Then I tried this code. And now timer doesn’t work at all:
local function destroy( event )
if event.phase == "ended"
then timer.performWithDelay( 500, destroy\_blurp, 1)
balloon\_blue.isVisible = false
end
end
balloon\_blue:addEventListener( "touch", destroy )
^This way I want to say that when I click balloon it disappears and also timer starts counting so that ‘blurp’ image would gone after half of a second. But ‘blurp’ image just stays.
So what’s my problem? [import]uid: 46567 topic_id: 10049 reply_id: 310049[/import]
