diff options
author | David Thompson <dthompson2@worcester.edu> | 2014-01-10 07:52:06 -0500 |
---|---|---|
committer | David Thompson <dthompson2@worcester.edu> | 2014-01-10 07:52:06 -0500 |
commit | 0262d88b83ec5023c1ff2df711219ad8e89b8f3b (patch) | |
tree | e2ad2d86a63bdf0077958f6a60d4cd074def01b2 | |
parent | 5523027f6369e9ec3f990144e8ef2cd4f243476e (diff) |
Update animation example.
* 2d/examples/animation.scm: Updated.
-rw-r--r-- | examples/animation.scm | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/examples/animation.scm b/examples/animation.scm index bee35c2..5464a7d 100644 --- a/examples/animation.scm +++ b/examples/animation.scm @@ -1,12 +1,12 @@ (use-modules (2d animation) (2d game) - (2d scene) (2d sprite) - (2d stage) (2d tileset) (2d vector2) (2d window)) +(load "common.scm") + (define (make-demo-animation) "Load a texture, split it into 64x64 tiles, and build an animated sprite out of it." @@ -21,17 +21,10 @@ sprite out of it." (tileset-ref tiles 26)))) (make-animation frames 6 #t))) -(define animation-scene - (make-scene - "Animation" - #:init (lambda () - (make-sprite (make-demo-animation) - #:position (vector2 320 240))) - #:draw draw-sprite)) +(define sprite (make-sprite (make-demo-animation) + #:position (vector2 320 240))) -(define animation-demo - (make-game - #:title "Animation" - #:first-scene animation-scene)) +(add-hook! draw-hook (lambda (dt alpha) (draw-sprite sprite))) -(run-game animation-demo) +(with-window (make-window #:title "Animation") + (run-game-loop)) |