mod = ... mod.create_scene = () -> ret = am.group! ret\append(mod.starfield!) ret ^ am.translate(0,0) ^ am.rotate(0) ^ am.sprite("data/complete.png") ret stars = { "data/star1.png" "data/star2.png" "data/star3.png" } mod.starfield = () -> ret = am.group! ret\action(coroutine.create(() -> while true --Randomly create stars with a 0.01 chance if math.random() < 0.2 star_y = math.random(-256,256) star_sprite = stars[math.random(#stars)] star = am.translate(-512,star_y) ^ am.scale(1) ^ am.sprite(star_sprite) starspeed = math.random(20,50) star\action(coroutine.create(() -> while star.x <= 550 star.x += starspeed coroutine.yield! ret\remove(star) coroutine.yield true )) ret\append(star) coroutine.yield! )) ret mod