diff options
author | David Thompson <dthompson@vistahigherlearning.com> | 2021-10-22 08:16:33 -0400 |
---|---|---|
committer | David Thompson <dthompson@vistahigherlearning.com> | 2021-10-22 08:16:33 -0400 |
commit | 49a97b24e8316584a7815fb845d28ffc28321427 (patch) | |
tree | f7699ca9beda907a00f94d31b32d18fac46e133a | |
parent | 699b462f9c932f5862399a8119a3ef46f55c61a4 (diff) |
Make text more readable.
-rw-r--r-- | bonnie-bee/game.scm | 84 |
1 files changed, 49 insertions, 35 deletions
diff --git a/bonnie-bee/game.scm b/bonnie-bee/game.scm index 4687a33..feb395e 100644 --- a/bonnie-bee/game.scm +++ b/bonnie-bee/game.scm @@ -27,6 +27,27 @@ #:use-module (starling scene) #:export (<game>)) +(define %text-color (rgb #xfee761)) + +(define-class <shadow-label> (<label>)) + +(define-method (on-boot (label <shadow-label>)) + (next-method) + (attach-to label + (make <label> + #:name 'shadow + #:position (vec2 0.0 1.0) + #:font (font label) + #:text (text label) + #:color (color label))) + (set! (color label) black)) + +(define-method (on-change (label <shadow-label>) slot-name old new) + (next-method) + (case slot-name + ((text) + (set! (text (& label shadow)) new))) ) + (define %game-bounds (make-rect 0.0 0.0 %game-width %game-height)) (define-class <game> (<scene-2d>) @@ -69,26 +90,29 @@ #:name 'bullets #:rank 3 #:quadtree (quadtree game)) - (make <label> + (make <shadow-label> #:name 'hud-lives #:rank 5 #:position (vec2 2.0 2.0) #:font monogram-font - #:text "lives 0") - (make <label> + #:text "lives 0" + #:color %text-color) + (make <shadow-label> #:name 'hud-pollen #:rank 5 #:position (vec2 (/ %game-width 2.0) 2.0) #:font monogram-font #:text "pollen 0" - #:align 'center) - (make <label> + #:align 'center + #:color %text-color) + (make <shadow-label> #:name 'hud-score #:rank 5 #:position (vec2 (- %game-width 2.0) 2.0) #:font monogram-font #:text "score 0" - #:align 'right))) + #:align 'right + #:color %text-color))) (define-method (play-music (game <game>) music-asset) (set-source-audio! (music-source game) (asset-ref music-asset)) @@ -100,7 +124,7 @@ #:position p #:hitbox (make-rect -32.0 -32.0 64.0 64.0) #:health 24 - #:points 200))) + #:points 500))) (run-script turret (sleep (steps 1)) (forever @@ -140,35 +164,21 @@ #:velocity (vec2 0.0 -2.0) #:hitbox (make-rect -28.0 -19.0 56.0 38.0) #:health 20 - #:points 300)) + #:points 1000)) (define-method (change-state (game <game>) new-state) (set! (state game) new-state)) (define-method (run-level (game <game>)) - ;; Outline: - ;; - ;; * There are flowers all around, bee moving between them happily. - ;; Then the boss shows up, and blasts all the flowers away. - ;; - ;; * Level starts scrolling, player gets control and is taught the - ;; controls with just flowers around. - ;; - ;; * A few popcorn enemies appear - ;; - ;; * Turrets begin to appear, along with more popcorn - ;; - ;; * Moths appear - ;; - ;; * Boss (define (tutorial message key) - (let ((l (make <label> + (let ((l (make <shadow-label> #:name 'tutorial #:rank 5 #:position (vec2 (/ %game-width 2.0) (/ %game-height 2.0)) #:font monogram-font #:text message - #:align 'center))) + #:align 'center + #:color %text-color))) (attach-to game l) (if key (wait-until (key-pressed? key)) @@ -492,7 +502,7 @@ #:position (vec2 (/ %game-width 2.0) (+ %game-height 32.0)) #:hitbox (make-rect -64.0 -32.0 128.0 64.0) #:health 1200 - #:points 1000000))) + #:points 100000))) (spawn game boss) (change-velocity boss 0.0 -1.0) (sleep 1.4) @@ -500,7 +510,7 @@ (wait-until (dead? (& game boss)))) ;; Victory! (set! (invincible? (player game)) #t) - (add-to-score (player game) (* (lives (player game)) 500000)) + (add-to-score (player game) (* (lives (player game)) 50000)) (game-complete game))) (define-method (reset-game (game <game>)) @@ -560,16 +570,18 @@ #:rank 5))) (attach-to game group) (attach-to group - (make <label> + (make <shadow-label> #:position (vec2 (/ %game-width 2.0) (/ %game-height 2.0)) #:font monogram-font #:text "WELL DONE, LITTLE BEE!" - #:align 'center) - (make <label> + #:align 'center + #:color %text-color) + (make <shadow-label> #:position (vec2 (/ %game-width 2.0) (- (/ %game-height 2.0) 20.0)) #:font monogram-font #:text "press ENTER to play again" - #:align 'center))) + #:align 'center + #:color %text-color))) (forever (add-bullet (bullets game) pollen-pickup @@ -599,16 +611,18 @@ #:rank 5))) (attach-to game group) (attach-to group - (make <label> + (make <shadow-label> #:position (vec2 (/ %game-width 2.0) (/ %game-height 2.0)) #:font monogram-font #:text "GAME OVER" - #:align 'center) - (make <label> + #:align 'center + #:color %text-color) + (make <shadow-label> #:position (vec2 (/ %game-width 2.0) (- (/ %game-height 2.0) 20.0)) #:font monogram-font #:text "press ENTER to try again" - #:align 'center)))) + #:align 'center + #:color %text-color)))) (define-method (on-key-press (game <game>) key modifiers repeat?) (case (state game) |