summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2013-10-23 23:06:03 -0400
committerDavid Thompson <dthompson2@worcester.edu>2013-10-23 23:06:03 -0400
commitadebc9363aa3b57ed05400a0d1a01ead3ac98b4a (patch)
tree4c7f648beed0a714447bc8a49cca6ca5297d0b31
parentc7ea1a30707665d0ca99de570bf8db57455672ef (diff)
Update actions example.
-rw-r--r--examples/action.scm29
1 files changed, 16 insertions, 13 deletions
diff --git a/examples/action.scm b/examples/action.scm
index fa44c5e..2886c0a 100644
--- a/examples/action.scm
+++ b/examples/action.scm
@@ -2,15 +2,20 @@
(2d agenda)
(2d coroutine)
(2d game)
+ (2d game-loop)
+ (2d scene)
(2d sprite)
+ (2d stage)
(2d vector2))
(define (demo-sprite)
(load-sprite "images/ghost.png"
#:position (vector2 320 240)))
-(define (start sprite)
- (let ((size (game-resolution actions)))
+(define (init)
+ (let ((size (game-resolution actions-demo))
+ (sprite (demo-sprite)))
+ (stage-define sprite sprite)
(schedule-action
(action-parallel
;; Move horizontally across the screen in 60 frames.
@@ -24,16 +29,14 @@
(set-sprite-rotation! sprite angle))
0 360 120)))))
-(define-scene demo
- #:title "Demo"
- #:draw (lambda (sprite) (draw-sprite sprite))
- #:events (append
- (default-scene-events)
- `((start . ,(lambda (sprite) (start sprite)))))
- #:state (demo-sprite))
+(define demo-scene
+ (make-scene
+ #:init init
+ #:draw (lambda () (draw-sprite (stage-ref sprite)))))
-(define-game actions
- #:title "actions"
- #:first-scene demo)
+(define actions-demo
+ (make-game
+ #:title "Actions"
+ #:first-scene demo-scene))
-(run-game actions)
+(run-game actions-demo)