From 9165b44f26d98ef4ed2b794092fdf4e6da4b5f15 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 21 Aug 2013 22:17:02 -0400 Subject: Update action example. --- examples/action.scm | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'examples/action.scm') diff --git a/examples/action.scm b/examples/action.scm index eb2d65e..e5dce93 100644 --- a/examples/action.scm +++ b/examples/action.scm @@ -32,23 +32,15 @@ (add-hook! on-render-hook (lambda () (render))) (add-hook! on-key-down-hook (lambda (key mod unicode) (key-down key mod unicode))) -;; Simple script that moves the sprite to a random location every -;; second. -(agenda-schedule - (colambda () - (lerp (lambda (i) - (set-sprite-position! sprite (vector i (/ window-height 2)))) - 0 - 800 - 120))) - -(agenda-schedule - (colambda () - (lerp (lambda (angle) - (set-sprite-rotation! sprite angle)) - 0 - 1080 - 120))) - +(schedule-action + (action-parallel + ;; Move horizontally across the screen in 60 frames. + (lerp (lambda (x) + (set-sprite-position! sprite (vector x (/ window-height 2)))) + 0 800 60) + ;; Rotate 1080 degrees in 120 frames. + (lerp (lambda (angle) + (set-sprite-rotation! sprite angle)) + 0 1080 60))) (run-game-loop) -- cgit v1.2.3