diff options
-rw-r--r-- | scenes/game.scm | 39 |
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))) |