function addStar(\_x,\_y) local star = display.newImage("star2.png") star.x = \_x; star.y = \_y; --star.x = 325; star.y = 200; function starDanceB() transition.to( star, { time=1000, rotation=-20, onComplete=starDanceA()} ) end function starDanceA() transition.to( star, { time=1000, rotation=20, onComplete=starDanceB()} ) end ...
I create three stars, and only the third star maintains the “rotating loop” throughout the game. The first two stars iterate through the loop once and then stop (i.e., rotate -20 degrees and then 20 degrees and stop).
Is there a way to make it so that a rotation loop can be added to any item created on the go with a function and not just the most recent object?