summaryrefslogtreecommitdiff
path: root/bonnie-bee/common.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson@vistahigherlearning.com>2021-10-23 17:09:34 -0400
committerDavid Thompson <dthompson@vistahigherlearning.com>2021-10-23 17:09:34 -0400
commit3fc18437f905f18aa4bf3b688930dbc68f8721b3 (patch)
treee14a25532309c88e2a33d5a7641f381a69733966 /bonnie-bee/common.scm
parentfb31282c18f33acb6de24e604059df6d05477491 (diff)
Lots of tweaks and also sprite animations!
Diffstat (limited to 'bonnie-bee/common.scm')
-rw-r--r--bonnie-bee/common.scm27
1 files changed, 26 insertions, 1 deletions
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 <scene-2d>) duration)
+ (let ((bg (make <sprite>
+ #: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 <scene-2d>) duration)
+ (let ((bg (make <sprite>
+ #:rank 999
+ #:texture darkness-image)))
+ (attach-to scene bg)
+ (tween duration 0.0 1.0
+ (lambda (a)
+ (set! (tint bg) (transparency a))))
+ (detach bg)))