diff options
Diffstat (limited to 'examples/action.scm')
-rw-r--r-- | examples/action.scm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/action.scm b/examples/action.scm index 2886c0a..9f4dd65 100644 --- a/examples/action.scm +++ b/examples/action.scm @@ -8,31 +8,29 @@ (2d stage) (2d vector2)) -(define (demo-sprite) +(define-stage-variable sprite (load-sprite "images/ghost.png" #:position (vector2 320 240))) (define (init) - (let ((size (game-resolution actions-demo)) - (sprite (demo-sprite))) - (stage-define sprite sprite) + (let ((size (game-resolution actions-demo))) (schedule-action (action-parallel ;; Move horizontally across the screen in 60 frames. (lerp (lambda (x) (set-sprite-position! - sprite + (sprite) (vector2 x (/ (vy size) 2)))) 0 (vx size) 120) ;; Rotate 1080 degrees in 120 frames. (lerp (lambda (angle) - (set-sprite-rotation! sprite angle)) + (set-sprite-rotation! (sprite) angle)) 0 360 120))))) (define demo-scene (make-scene #:init init - #:draw (lambda () (draw-sprite (stage-ref sprite))))) + #:draw (lambda () (draw-sprite (sprite))))) (define actions-demo (make-game |