I need to display in succession, a 3-2-1 countdown timer. I do not know how to display text for a specified time. Can you help me?
Thanks
UPDATE
I figured it out. Here’s the code I used for a 3-2-1 countdown:
countdown3 = display.newText("3", 512, 384, "HelveticaNeue", 72)
timer.performWithDelay(1500, countdown2, 1)
This calls the function Countdown2 after 1.5 seconds.
function countdown2 ()
countdown3.isVisible = false
countdown2 = display.newText("2", 512, 384, "HelveticaNeue", 72)
timer.performWithDelay(1500, countdown1, 1)
end
This gets rid of the 3 and displays the 2, and calls Countdown1 after 1.5 seconds.
function countdown1 ()
countdown2.isVisible = false
countdown1 = display.newText("1", 512, 384, "HelveticaNeue", 72)
timer.performWithDelay(1500, countdownend, 1)
end
This gets rid of the 2 and displays the 1, and calls Countdownend afer 1.5 seconds.
function countdownend()
countdown1.isVisible = false
end
This gets rid of the last display of the countdown.
And that’s how I did my countdown. [import]uid: 48020 topic_id: 21366 reply_id: 321366[/import]
[import]uid: 52491 topic_id: 21366 reply_id: 84599[/import]