summaryrefslogtreecommitdiff
path: root/scenes/game.scm
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-07-15 22:00:11 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-07-27 17:15:44 +0200
commit8287a51f6ea8e11e20d75382835b5368cf75c62c (patch)
treef8dff5e9f48461882e147b30e9eefac159b9daec /scenes/game.scm
parentf260cc40384793e5d0ef4be741060eec72fc57f5 (diff)
Add reaper character.
Diffstat (limited to 'scenes/game.scm')
-rw-r--r--scenes/game.scm38
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))