aboutsummaryrefslogtreecommitdiff
path: root/src/complete.moon
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2020-02-02 08:11:08 -0500
committerAlexander Pickering <alex@cogarr.net>2020-02-02 08:11:08 -0500
commit57701059b1b65fc08366318e92d32d9dd7094d25 (patch)
treea569db68d27982d83fead3cc9c8192056c49509f /src/complete.moon
downloaddrydock-57701059b1b65fc08366318e92d32d9dd7094d25.tar.gz
drydock-57701059b1b65fc08366318e92d32d9dd7094d25.tar.bz2
drydock-57701059b1b65fc08366318e92d32d9dd7094d25.zip
inital commit
Diffstat (limited to 'src/complete.moon')
-rw-r--r--src/complete.moon37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/complete.moon b/src/complete.moon
new file mode 100644
index 0000000..f1af550
--- /dev/null
+++ b/src/complete.moon
@@ -0,0 +1,37 @@
+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