summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-01-13 18:41:53 -0500
committerDavid Thompson <dthompson2@worcester.edu>2014-01-13 18:41:53 -0500
commit3871ae0ee0d0c71cd2055d07b597a950f4b436ff (patch)
tree188711cf7faab41829f5a2ee3369bb7f74dfece3 /examples
parenteb8f5ce8201fb58a6a8212687849ad2b92da924d (diff)
Fix coroutine example to actually use coroutines.
Diffstat (limited to 'examples')
-rw-r--r--examples/coroutine.scm18
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)))