diff options
-rw-r--r-- | scenes/death.scm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/scenes/death.scm b/scenes/death.scm index 336294a..34a8af8 100644 --- a/scenes/death.scm +++ b/scenes/death.scm @@ -196,7 +196,13 @@ void main (void) { reaper)))) (define-method (on-key-press (death <death>) key mods repeat?) - (abort-game)) + ;; Fade out + (script + (tween 60 0.0 1.0 + (lambda (alpha) + (set! (color (child-ref (parent death) 'fade-all)) + (make-color 0 0 0 alpha)))) + (abort-game))) (define-method (update (game <death>) dt) ;; Keep the player (and the fade box) in the centre @@ -251,12 +257,21 @@ void main (void) { (make <node-2d> #:name 'credits-container #:origin (vec2 (- (/ %width 2)) - (- (/ %height 2))))))) + (- (/ %height 2)))) + (make <filled-rect> + #:name 'fade-all + #:region (make-rect 0.0 0.0 %width %height) + #:color (make-color 0 0 0 1.0))))) (credits-container (child-ref container 'credits-container))) (with-agenda (agenda death) (script + ;; Fade in + (tween 15 1.0 0.0 + (lambda (alpha) + (set! (color (child-ref container 'fade-all)) + (make-color 0 0 0 alpha)))) (sleep 150) (set! (visible? player) #t) (walk player '(right)) |