From 3fc18437f905f18aa4bf3b688930dbc68f8721b3 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 23 Oct 2021 17:09:34 -0400 Subject: Lots of tweaks and also sprite animations! --- bonnie-bee/common.scm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'bonnie-bee/common.scm') diff --git a/bonnie-bee/common.scm b/bonnie-bee/common.scm index 75a6bc4..885ab33 100644 --- a/bonnie-bee/common.scm +++ b/bonnie-bee/common.scm @@ -1,17 +1,22 @@ (define-module (bonnie-bee common) + #:use-module (bonnie-bee assets) #:use-module (chickadee game-loop) #:use-module (chickadee graphics color) #:use-module (chickadee graphics viewport) #:use-module (chickadee math vector) + #:use-module (chickadee scripting) #:use-module (oop goops) #:use-module (starling scene) + #:use-module (starling node) #:use-module (starling node-2d) #:export (%window-width %window-height %game-width %game-height set-cameras! - steps)) + steps + fade-in + fade-out)) (define %window-width 960) (define %window-height 720) @@ -27,3 +32,23 @@ (define (steps n) (* n (current-timestep))) + +(define-method (fade-in (scene ) duration) + (let ((bg (make + #:rank 999 + #:texture darkness-image))) + (attach-to scene bg) + (tween duration 1.0 0.0 + (lambda (a) + (set! (tint bg) (transparency a)))) + (detach bg))) + +(define-method (fade-out (scene ) duration) + (let ((bg (make + #:rank 999 + #:texture darkness-image))) + (attach-to scene bg) + (tween duration 0.0 1.0 + (lambda (a) + (set! (tint bg) (transparency a)))) + (detach bg))) -- cgit v1.2.3