summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-07-27 12:35:19 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-07-27 17:15:50 +0200
commitb76680839240884264c05a0ca96aa5a1b564ae1c (patch)
treed2ea3a1ac50052ba7fa238c7f6daf1bc864b69b1
parent8e5233035145ee9d7684b590a7c6184937c38638 (diff)
Fade in death scene.
-rw-r--r--scenes/death.scm19
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))