SHOW:
|
|
- or go back to the newest paste.
| 1 | bg = display.newRect (100,100, 300, 300) | |
| 2 | ||
| 3 | local countdown | |
| 4 | - | r = math.random (1,255) |
| 4 | + | |
| 5 | - | bg:setFillColor (r,r,r) |
| 5 | + | |
| 6 | local r = math.random (1,255) | |
| 7 | bg:setFillColor (r,r,r) | |
| 8 | countdown = nil | |
| 9 | - | if event.phase == "ended" then |
| 9 | + | |
| 10 | - | if t~=nil then |
| 10 | + | |
| 11 | - | timer.cancel (t) |
| 11 | + | |
| 12 | - | end |
| 12 | + | if event.phase == "ended" then |
| 13 | - | local t = timer.performWithDelay(500, listener) |
| 13 | + | if countdown then |
| 14 | - | |
| 14 | + | timer.cancel (countdown) |
| 15 | countdown = nil | |
| 16 | end | |
| 17 | countdown = timer.performWithDelay(500, listener) | |
| 18 | end | |
| 19 | end | |
| 20 | ||
| 21 | bg:addEventListener ("touch", tl) |