summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scenes/death.scm15
1 files changed, 9 insertions, 6 deletions
diff --git a/scenes/death.scm b/scenes/death.scm
index 1e35563..8f7048a 100644
--- a/scenes/death.scm
+++ b/scenes/death.scm
@@ -43,6 +43,7 @@
(define-asset vignette-image (load-image "assets/images/vignette.png"))
(define-class <death> (<scene>)
+ (quitting? #:accessor quitting? #:init-form #f)
(tile-map #:accessor tile-map #:init-form death-map)
(pretend-walking? #:accessor pretend-walking? #:init-form #f))
@@ -200,12 +201,14 @@ void main (void) {
(define-method (on-key-press (death <death>) key mods repeat?)
;; 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)))
+ (unless (quitting? death)
+ (set! (quitting? death) #t)
+ (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