From b76680839240884264c05a0ca96aa5a1b564ae1c Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Fri, 27 Jul 2018 12:35:19 +0200 Subject: Fade in death scene. --- scenes/death.scm | 19 +++++++++++++++++-- 1 file 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 ) 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 ) dt) ;; Keep the player (and the fade box) in the centre @@ -251,12 +257,21 @@ void main (void) { (make #:name 'credits-container #:origin (vec2 (- (/ %width 2)) - (- (/ %height 2))))))) + (- (/ %height 2)))) + (make + #: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)) -- cgit v1.2.3