diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-01-13 18:41:53 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-01-13 18:41:53 -0500 |
commit | 3871ae0ee0d0c71cd2055d07b597a950f4b436ff (patch) | |
tree | 188711cf7faab41829f5a2ee3369bb7f74dfece3 | |
parent | eb8f5ce8201fb58a6a8212687849ad2b92da924d (diff) |
Fix coroutine example to actually use coroutines.
-rw-r--r-- | examples/coroutine.scm | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/coroutine.scm b/examples/coroutine.scm index cd01381..480aa46 100644 --- a/examples/coroutine.scm +++ b/examples/coroutine.scm @@ -15,13 +15,17 @@ ;; Simple script that moves the sprite to a random location every ;; second. -(schedule-interval - (lambda () - (set-sprite-position! - sprite - (vector2 (random window-width) - (random window-height)))) - 60) +(codefine (script) + (set-sprite-position! + sprite + (vector2 (random window-width) + (random window-height))) + (wait 15) + (set-sprite-rotation! sprite (random 360)) + (wait 15) + (script)) + +(schedule-next script) (add-hook! draw-hook (lambda (dt alpha) (draw-sprite sprite))) |