From 3871ae0ee0d0c71cd2055d07b597a950f4b436ff Mon Sep 17 00:00:00 2001 From: David Thompson Date: Mon, 13 Jan 2014 18:41:53 -0500 Subject: Fix coroutine example to actually use coroutines. --- examples/coroutine.scm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'examples/coroutine.scm') 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))) -- cgit v1.2.3