I can’t seem to get this to work. It only draws one dot.
[lua]function Star:new()
local Star = display.newImage(‘star.png’)
function Star:follow()
local Starcopy = self
function Star:followMe()
local num = 0
if Starcopy.dots then num = #Starcopy.dots end
local dot = display.newCircle( Starcopy.x, Starcopy.y, 30 )
Starcopy.parent:insert(dot)
Starcopy.dots[num + 1] = dot
end
self.timer = timer.performWithDelay(50, followMe, 0)
end
return Star
end
local sky = display.newGroup()
local Orion = Star:new()
sky:insert(Orion)
Orion.x = 50; Orion.y = 50
Orion:follow()
transition.to(Orion, {x = 1000, y = 1000, time = 8000})[/lua]
–I have edited the code and renamed the title in hope that it will be useful for someone else.
This code will produce circles at the x and y direction every 50 milliseconds. So if the Star is in motion there will be a trail of circles following the Star. It is written to be easily inserted into a class. [import]uid: 54716 topic_id: 12581 reply_id: 312581[/import]