diff options
Diffstat (limited to 'characters')
-rw-r--r-- | characters/lorenzo.scm | 66 |
1 files changed, 20 insertions, 46 deletions
diff --git a/characters/lorenzo.scm b/characters/lorenzo.scm index 8a59e72..8c8971f 100644 --- a/characters/lorenzo.scm +++ b/characters/lorenzo.scm @@ -1,5 +1,5 @@ ;;; The Inevitable Game -;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net> ;;; ;;; This program is free software: you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -18,7 +18,6 @@ (define-module (characters lorenzo) #:use-module (chickadee render texture) #:use-module (chickadee render color) - #:use-module (chickadee render shader) #:use-module (chickadee math rect) #:use-module (chickadee math vector) #:use-module (engine assets) @@ -40,34 +39,6 @@ player-atlas)) -;; Copied from (chickadee render sprite) -(define default-shader - (delay - (strings->shader - " -#version 130 - -in vec2 position; -in vec2 tex; -out vec2 frag_tex; -uniform mat4 mvp; - -void main(void) { - frag_tex = tex; - gl_Position = mvp * vec4(position.xy, 0.0, 1.0); -} -" - " -#version 130 - -in vec2 frag_tex; -uniform sampler2D color_texture; - -void main (void) { - gl_FragColor = texture2D(color_texture, frag_tex); -} -"))) - (define-class <player> (<character>) (previous-key-presses #:accessor previous-key-presses #:init-form (list)) (selecting-message? #:accessor selecting-message? #:init-form #f) @@ -84,7 +55,7 @@ void main (void) { (define* (lorenzo #:key (position (vec2 0 0)) - (shader default-shader)) + (dead? #f)) (make <player> #:name 'player #:position position @@ -93,7 +64,9 @@ void main (void) { (make <animated-sprite> #:name 'sprite #:atlas player-atlas - #:shader shader + #:tint (if dead? + (make-color 1.0 1.0 1.0 0.5) + (make-color 1.0 1.0 1.0 1.0)) #:animations '((idle-right . #(24 24 24 24 24 39 39 39 39 39)) (idle-left . #(32 32 32 32 32 31 31 31 31 31)) (idle-front . #(8 8 8 8 8 0 0 0 0 0)) @@ -104,17 +77,18 @@ void main (void) { (down . #(9 8 10 8))) #:current-animation 'idle-front #:frame-duration 10) - ;; 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)))))) + (if dead? '() + ;; 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))))))) |