summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-07-27 12:35:05 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-07-27 17:15:50 +0200
commit8e5233035145ee9d7684b590a7c6184937c38638 (patch)
tree60b662b1fb28726d0906c4b7e8b686adda27ff10
parentb81b62e47c1367f0fb170baf7f9c509b65109cf9 (diff)
Fade when teleporting.
-rw-r--r--scenes/game.scm39
1 files changed, 29 insertions, 10 deletions
diff --git a/scenes/game.scm b/scenes/game.scm
index 7ec2306..ac6d7df 100644
--- a/scenes/game.scm
+++ b/scenes/game.scm
@@ -229,23 +229,42 @@ positions layer."
(define (handle-action player)
"Check if the PLAYER is on any region of the map where an action can
be executed; if so, perform the action."
- (let ((game (parent player)))
+ (let* ((game (parent player))
+ (fade (child-ref (parent game) 'fade-box)))
(and=> (collides? player game "actions")
(lambda (obj)
(match (map-object-name obj)
("enter-house"
(let ((house-pos (location game "house")))
- (teleport player
- (vec2-x house-pos)
- (vec2-y house-pos)))
- ;; TODO: change music?
- (pause-music))
+ (script
+ (tween 15 0.0 1.0
+ (lambda (alpha)
+ (set! (color fade)
+ (make-color 0 0 0 alpha))))
+ (teleport player
+ (vec2-x house-pos)
+ (vec2-y house-pos))
+ ;; TODO: change music?
+ (pause-music)
+ (tween 15 1.0 0.0
+ (lambda (alpha)
+ (set! (color fade)
+ (make-color 0 0 0 alpha)))))))
("exit-house"
(let ((exited-house-pos (location game "exited-house")))
- (teleport player
- (vec2-x exited-house-pos)
- (vec2-y exited-house-pos)))
- (resume-music))
+ (script
+ (tween 15 0.0 1.0
+ (lambda (alpha)
+ (set! (color fade)
+ (make-color 0 0 0 alpha))))
+ (teleport player
+ (vec2-x exited-house-pos)
+ (vec2-y exited-house-pos))
+ (resume-music)
+ (tween 15 1.0 0.0
+ (lambda (alpha)
+ (set! (color fade)
+ (make-color 0 0 0 alpha)))))))
("talk-to-reaper"
(start-talking player
(child-ref game 'reaper)))