summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@member.fsf.org>2013-08-21 22:17:02 -0400
committerDavid Thompson <dthompson@member.fsf.org>2013-08-21 22:17:02 -0400
commit9165b44f26d98ef4ed2b794092fdf4e6da4b5f15 (patch)
tree3f6ac369e289e1f646a5c454f1f831a7c26887f1
parentf2e0bf38c7cd0f2ee4d589d92fffbbffabbe5428 (diff)
Update action example.
-rw-r--r--examples/action.scm28
1 files changed, 10 insertions, 18 deletions
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)