Can somebody help me spawn out random colored circles on the screen ten seconds apart. [import]uid: 51459 topic_id: 13836 reply_id: 313836[/import]
easy as pie
[lua]local rand = math.random
local function spawn_circles()
circle = display.newCircle(rand(10,320),rand(10,480), 10)
circle:setFillColor(rand(1,255),rand(1,255),rand(1,255))
end
timer.performWithDelay(10000, spawn_circles, 0)[/lua] [import]uid: 16142 topic_id: 13836 reply_id: 50805[/import]
Thanks Dark console!!
[import]uid: 51459 topic_id: 13836 reply_id: 50809[/import]
But I want to be able to track touches on these circles… Is that possible? [import]uid: 51459 topic_id: 13836 reply_id: 50812[/import]
to track touch you may use this
[lua]local rand = math.random
local function touchCircle()
print(“am touched !”)
end
local function spawn_circles()
circle = display.newCircle(rand(10,320),rand(10,480), 10)
circle:setFillColor(rand(1,255),rand(1,255),rand(1,255))
circle:addEventListener(“tap”,touchCircle)
end
timer.performWithDelay(1500, spawn_circles, 0)[/lua] [import]uid: 71210 topic_id: 13836 reply_id: 50816[/import]
Thnaks that works! [import]uid: 51459 topic_id: 13836 reply_id: 50818[/import]