diff options
Diffstat (limited to 'bonnie-bee/game.scm')
-rw-r--r-- | bonnie-bee/game.scm | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/bonnie-bee/game.scm b/bonnie-bee/game.scm index 4d02490..18b177b 100644 --- a/bonnie-bee/game.scm +++ b/bonnie-bee/game.scm @@ -90,7 +90,7 @@ #:end-color (make-color 1.0 1.0 1.0 0.0))) (make <bullets> #:name 'bullets - #:rank 3 + #:rank 4 #:quadtree (quadtree game)) (make <shadow-label> #:name 'hud-lives @@ -453,7 +453,7 @@ (when (< i 8) (let* ((arc-start (- (* pi 1.5) 0.2)) (arc-end (+ (* pi 1.5) 0.2)) - (n 8) + (n 9) (arc-step (/ (- arc-end arc-start) n)) (speed 1.9)) (audio-play (asset-ref enemy-shoot-sound)) @@ -474,7 +474,6 @@ (unless (getenv "SKIP_WAVE3") (spawn-moth (vec2 (* %game-width 0.5) (+ %game-height 16.0))) (spawn-flower (* %game-width 0.125)) - (spawn-flower (* %game-width 0.875)) (sleep 4.0) (spawn-moth (vec2 (* %game-width 0.25) (+ %game-height 16.0))) (spawn-flower (* %game-width 0.375)) @@ -509,6 +508,10 @@ ;; Boss (unless (getenv "SKIP_BOSS") (run-script game + (repeat 8 + (audio-play (asset-ref alarm-sound)) + (sleep 1.0))) + (run-script game (let ((warning (make <shadow-label> #:name 'warning #:rank 9 @@ -533,7 +536,8 @@ (tween 1.0 15.0 0.0 (lambda (speed) (change-scroll-speed game speed))) - (wait-until (dead? (& game boss)))) + (wait-until (dead? (& game boss))) + (clear-bullets (bullets game))) ;; Victory! (set! (invincible? (player game)) #t) (add-to-score (player game) (* (lives (player game)) 50000)) @@ -556,7 +560,7 @@ (spawn game (make <player> #:name 'player - #:rank 4 + #:rank 3 #:position (vec2 (/ %game-width 2.0) 20.0) #:hitbox (make-rect -0.5 -0.5 1.0 1.0))) (run-level game)) @@ -654,11 +658,13 @@ (if (paused? game) (begin (detach (& game pause-overlay)) + (source-play (music-source game)) (resume game)) (let ((overlay (make <node-2d> #:name 'pause-overlay #:rank 99))) (pause game) + (source-pause (music-source game)) (attach-to overlay (make <sprite> #:texture darkness-image @@ -673,6 +679,7 @@ (attach-to game overlay)))) (define-method (play-again (game <game>)) + (change-state game 'play-again) (run-script game (tween 0.5 1.0 0.0 (lambda (volume) @@ -683,6 +690,12 @@ (fade-out game 1.0) (reset-game game))) +(define-method (close-game (game <game>)) + (pop-scene (current-kernel))) + +(define-method (on-quit (game <game>)) + (close-game game)) + (define-method (on-key-press (game <game>) key modifiers repeat?) (case (state game) ((play) @@ -699,20 +712,20 @@ (set! (shoot? (player game)) #t)) ((x) (bomb (player game))) - ((q) - (pop-scene (current-kernel))) + ((escape) + (close-game game)) ((return) (toggle-pause game)))) ((intro) (case key - ((q) - (pop-scene (current-kernel))) + ((escape) + (close-game game)) ((return) (toggle-pause game)))) ((game-over game-complete) (case key - ((q) - (pop-scene (current-kernel))) + ((escape) + (close-game game)) ((return) (play-again game)))))) |