summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-07-08 10:16:23 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-07-27 17:15:43 +0200
commit128ad5a6bb433a656805c0605aac28b0f6fad758 (patch)
tree6f5d8fae63291179785020496c64bcc03d14ad5d
parent0a50d6c79aa7893fa2c7ce0326e87e1f44410248 (diff)
Add a simple player shadow.
-rw-r--r--scenes/game.scm17
1 files changed, 16 insertions, 1 deletions
diff --git a/scenes/game.scm b/scenes/game.scm
index cc110f9..1011b2d 100644
--- a/scenes/game.scm
+++ b/scenes/game.scm
@@ -133,7 +133,22 @@
(define-method (populate (game <game>))
(let ((player (make <player>
#:name 'player
- #:position (vec2 620.0 1100.0))))
+ #:position (vec2 620.0 1100.0)
+ #:children
+ ;; Simple player 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 x (- 2 n))
+ #:color color))
+ ;; position in the stack
+ (iota 5)
+ ;; x offsets
+ (list 12 10 8 10 12)
+ ;; widths
+ (list 8 12 16 12 8))))))
(set! %player player)
(list player
(make <filled-rect>