summaryrefslogtreecommitdiff
path: root/bonnie-bee/game.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/game.scm
parentfb31282c18f33acb6de24e604059df6d05477491 (diff)
Lots of tweaks and also sprite animations!
Diffstat (limited to 'bonnie-bee/game.scm')
-rw-r--r--bonnie-bee/game.scm96
1 files changed, 57 insertions, 39 deletions
diff --git a/bonnie-bee/game.scm b/bonnie-bee/game.scm
index feb395e..b868cd2 100644
--- a/bonnie-bee/game.scm
+++ b/bonnie-bee/game.scm
@@ -85,7 +85,9 @@
#:texture background-image)
(make <particles>
#:name 'particles
- #:particles (make-particles 2048 #:texture (asset-ref particle-image)))
+ #:particles (make-particles 2048
+ #:texture (asset-ref particle-image)
+ #:end-color (make-color 1.0 1.0 1.0 0.0)))
(make <bullets>
#:name 'bullets
#:rank 3
@@ -185,18 +187,20 @@
(sleep 2.0))
(detach l)))
(run-script game
+ (fade-in game 1.0))
+ (run-script game
(unless (getenv "SKIP_INTRO")
;; Intro
(let ((popcorn (make-popcorn (vec2 (/ %game-width 2.0) (+ %game-height 16.0))))
(bullet-speed 5.0)
- (flower-1 (make-flower (vec2 174.0 227.0)))
- (flower-2 (make-flower (vec2 50.0 226.0)))
+ (flower-1 (make-flower (vec2 194.0 210.0)))
+ (flower-2 (make-flower (vec2 50.0 206.0)))
(flower-3 (make-flower (vec2 280.0 201.0)))
(flower-4 (make-flower (vec2 121.0 197.0)))
- (flower-5 (make-flower (vec2 54.0 134.0)))
- (flower-6 (make-flower (vec2 150.0 121.0)))
- (flower-7 (make-flower (vec2 256.0 131.0)))
- (flower-8 (make-flower (vec2 307.0 109.0))))
+ (flower-5 (make-flower (vec2 58.0 134.0)))
+ (flower-6 (make-flower (vec2 145.0 135.0)))
+ (flower-7 (make-flower (vec2 220.0 151.0)))
+ (flower-8 (make-flower (vec2 290.0 129.0))))
(define (shoot-at flower)
(audio-play (asset-ref enemy-shoot-sound))
(add-bullet (bullets game)
@@ -204,7 +208,6 @@
(position popcorn)
(vec2* (direction-to popcorn flower) bullet-speed)))
(change-state game 'intro)
- (play-music game intro-music)
(spawn game flower-1)
(spawn game flower-2)
(spawn game flower-3)
@@ -214,13 +217,13 @@
(spawn game flower-7)
(spawn game flower-8)
(spawn game (make-flower (vec2 194.0 95.0)))
- (spawn game (make-flower (vec2 102.0 76.0)))
- (spawn game (make-flower (vec2 26.0 58.0)))
+ (spawn game (make-flower (vec2 102.0 82.0)))
(spawn game (make-flower (vec2 247.0 45.0)))
- (spawn game (make-flower (vec2 169.0 12.0)))
- (spawn game (make-flower (vec2 53.0 7.0)))
- (teleport (player game) 169.0 12.0)
- (sleep 0.6)
+ (spawn game (make-flower (vec2 159.0 40.0)))
+ (spawn game (make-flower (vec2 73.0 28.0)))
+ (teleport (player game) 159.0 40.0)
+ (play-music game intro-music)
+ (sleep 1.0)
(audio-play (asset-ref pollen-release-sound))
(sleep 0.6)
(move-to (player game) 247.0 45.0 1.0)
@@ -238,8 +241,9 @@
(source-stop (music-source game))
(spawn game popcorn)
(change-velocity popcorn 0.0 -1.0)
- (sleep 1.5)
- (change-velocity popcorn 0.0 0.0)
+ (tween 2.4 -1.0 0.0
+ (lambda (dy)
+ (change-velocity popcorn 0.0 dy)))
(shoot-at flower-1)
(sleep 0.3)
(shoot-at flower-2)
@@ -248,15 +252,19 @@
(sleep 0.3)
(shoot-at flower-4)
(sleep 0.3)
- (shoot-at flower-5)
- (sleep 0.3)
- (shoot-at flower-6)
+ (shoot-at flower-8)
(sleep 0.3)
(shoot-at flower-7)
(sleep 0.3)
- (shoot-at flower-8)
- (sleep 2.0)
- (change-velocity popcorn 0.0 1.5)
+ (shoot-at flower-6)
+ (sleep 0.3)
+ (shoot-at flower-5)
+ (sleep 1.0)
+ (audio-play (asset-ref hehehe-sound))
+ (sleep 1.0)
+ (tween 0.5 0.0 1.5
+ (lambda (dy)
+ (change-velocity popcorn 0.0 dy)))
(sleep 1.0)))
(enable-pollen!)
(change-state game 'play)
@@ -318,7 +326,6 @@
(vec2 -2.0 2.0) 0.2)
(sleep 3.0))
;; Wave 2
- ;; kamikaze popcorn, turrets, more flowers
(define (spawn-turret x)
(spawn game (make-turret (vec2 x (+ %game-height 32.0)))))
(define (shoot-down enemy)
@@ -393,9 +400,16 @@
(spawn-flower 153.0)
(sleep 1.0)
(spawn-turret 209.0)
+ (sleep 1.0)
(popcorn-line 10 (vec2 (+ %game-width 16.0) 200.0)
(vec2 -3.0 -0.5) 0.2)
- (sleep 8.0)
+ (sleep 1.0)
+ (popcorn-line 10 (vec2 -16.0 200.0)
+ (vec2 3.0 -0.5) 0.2)
+ (sleep 1.0)
+ (popcorn-line 10 (vec2 (+ %game-width 16.0) 200.0)
+ (vec2 -3.0 -0.5) 0.2)
+ (sleep 1.0)
(run-script game
(spawn-turret (* %game-width 0.25))
(sleep 2.0)
@@ -408,7 +422,8 @@
(spawn-turret (* %game-width 0.25)))
(repeat 100
(let ((popcorn (make-popcorn (vec2 (+ (/ %game-width 2.0)
- (* (/ %game-width 4.0) (- (random:uniform) 0.5)))
+ (* (/ %game-width 4.0)
+ (- (random:uniform) 0.5)))
(+ %game-height 16.0))
(vec2 0.0 -2.0))))
(spawn game popcorn)
@@ -424,7 +439,6 @@
(sleep 0.1))
(sleep 8.0))
;; Wave 3
- ;; moths, more turrets, more flowers
(define (spawn-moth p)
(let ((moth (make-moth p)))
(spawn game moth)
@@ -490,23 +504,21 @@
(spawn-moth (vec2 (* %game-width 0.25) (+ %game-height 16.0)))
(spawn-moth (vec2 (* %game-width 0.5) (+ %game-height 16.0)))
(spawn-moth (vec2 (* %game-width 0.75) (+ %game-height 16.0)))
- (sleep 6.0))
+ (sleep 14.0))
;; Boss
- (tween 1.0 15.0 0.0
- (lambda (speed)
- (change-scroll-speed game speed)))
(unless (getenv "SKIP_BOSS")
- (let ((boss (make <boss>
+ (spawn game (make <boss>
#:name 'boss
#:rank 2
- #:position (vec2 (/ %game-width 2.0) (+ %game-height 32.0))
+ #:position (vec2 (/ %game-width 2.0)
+ (+ %game-height 32.0))
#:hitbox (make-rect -64.0 -32.0 128.0 64.0)
#:health 1200
- #:points 100000)))
- (spawn game boss)
- (change-velocity boss 0.0 -1.0)
- (sleep 1.4)
- (change-velocity boss 0.0 0.0))
+ #:points 100000))
+ (sleep 4.5)
+ (tween 1.0 15.0 0.0
+ (lambda (speed)
+ (change-scroll-speed game speed)))
(wait-until (dead? (& game boss))))
;; Victory!
(set! (invincible? (player game)) #t)
@@ -538,7 +550,6 @@
(reset-game game))
(define-method (game-complete (game <game>))
- (hide (& game hud-lives))
(hide (& game hud-pollen))
(tween 1.0 1.0 0.0
(lambda (volume)
@@ -647,7 +658,14 @@
((q)
(pop-scene (current-kernel)))
((return)
- (reset-game game))))
+ (run-script game
+ (tween 1.0 1.0 0.0
+ (lambda (volume)
+ (set-source-volume! (music-source game) volume)))
+ (source-stop (music-source game)))
+ (run-script game
+ (fade-out game 1.0)
+ (reset-game game)))))
((intro)
(case key
((q)