diff options
Diffstat (limited to 'scenes/game.scm')
-rw-r--r-- | scenes/game.scm | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/scenes/game.scm b/scenes/game.scm index 4e6be37..6ebbaab 100644 --- a/scenes/game.scm +++ b/scenes/game.scm @@ -112,6 +112,24 @@ #:frame-duration 10))) +(define-class <reaper> (<character>) + (talking #:accessor talking #:init-form #f)) + +(define-asset reaper-atlas + (load-atlas "assets/images/reaper.png" 32 32)) + +(define-method (populate (reaper <reaper>)) + (list + (make <animated-sprite> + #:name 'sprite + #:atlas reaper-atlas + #:animations '((idle . #(0 0 0 1 1 1 9 1 1 1 8 8 8 8 8 8 5 4 4 4 0 0 0 3 3)) + (pause . #(4 4 4 4 4 4 4 5)) + (talk . #(0 3 2 7 5 4 6 5 3 2 2 2 4 4 0 0 0))) + #:current-animation 'idle + #:frame-duration 20))) + + (define-asset test-map (load-tile-map "assets/maps/01.tmx")) (define-class <game> (<scene>) @@ -150,12 +168,30 @@ ;; widths (list 8 12 16 12 8)))))) (set! %player player) - (list player + (list (make <reaper> + #:name 'reaper + #:position (vec2 720.0 1100.0) + #:children + ;; Simple shadow. This should better be done with a + ;; single ellipse shader. + (let ((color (make-color 0 0 0 0.2))) + (map (lambda (n x w) + (make <filled-rect> + #:region (make-rect 0.0 0.0 w 1.0) + #:position (vec2 (+ 3 x) (- 2 n)) + #:color color)) + ;; position in the stack + (iota 5) + ;; x offsets + (list 12 10 8 10 12) + ;; widths + (list 12 16 20 16 12)))) (make <filled-rect> #:name 'hit #:region (make-rect 0.0 0.0 0.0 0.0) #:position (vec2 0 0) #:color (transparency 0.2)) + player (make <top-layer> #:name 'top-layer #:position (vec2 0.0 0.0)) |