I am trying to make a coin appear every few seconds at random points, and then move left and spin. I am able to do it with one, but I want them to continuously appear. The problem is that i need the delay to be 1 so it goes to my second function(to make it move), but I need them to appear often.
Here is my code:
[lua]
function updateRandomCoin(event)
check3 = math.random(640)
coin = display.newImage(“coin1.png”, check3, 100, true)
coin.xScale = 0.7
coin.yScale = 0.7
updateCoin()
end
timer.performWithDelay(1, updateRandomCoin, -1)
local function updateCoin(event)
coin.x = coin.x - 4
coin.rotation = coin.rotation + 3
end
timer.performWithDelay(1, updateCoin, -1)
[/lua]
