diff options
author | Gene Pasquet <dev@etenil.net> | 2024-05-26 11:08:32 +0100 |
---|---|---|
committer | Gene Pasquet <dev@etenil.net> | 2024-05-26 11:08:32 +0100 |
commit | 01e9651b1ad8051ec43a6a9ac5ef5a933cee744c (patch) | |
tree | cc4f9e174fd8a9cd5e9a8109efa79e7df7fadd4b | |
parent | 1f52f437c6555b23d0359eccf25d364493cf69aa (diff) |
Add help menu
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | TODO.org | 4 | ||||
-rw-r--r-- | turbo.scm | 196 |
3 files changed, 126 insertions, 76 deletions
@@ -1,4 +1,4 @@ .PHONY: play play: - chickadee play turbo.scm + chickadee play -t turbo turbo.scm @@ -15,7 +15,7 @@ ** DONE Level up automatically ** DONE Add graphical speedometer (look at knight rider) ** DONE Add start menu -** TODO Add help menu to display controls +** DONE Add help menu to display controls ** DONE Add timer ** DONE Trigger end game when reaching level max *** DONE Add end-game screen @@ -23,7 +23,7 @@ ** TODO Add weapon to player car *** TODO Make weapon a power-up *** TODO Make weapon use limited (bullet? time?) -** STARTED Improve visuals +** DONE Improve visuals ** TODO Reduce lanes to 3 from level 10 *** TODO Handle vehicles lane change for reductions ** DONE Add music @@ -93,7 +93,8 @@ (define game-started? #f) (define game-over? #f) (define show-credits? #f) -(define menu-items (list 'new-game 'credits 'quit)) +(define show-help? #f) +(define menu-items (list 'new-game 'credits 'help 'quit)) (define menu-selection 0) (define (vehicle-has-spawn-space? vehicle) @@ -221,9 +222,9 @@ ;;;; Chickadee hooks -(set-source-volume! music 0.5) +(set-source-volume! music 0.3) -; (source-play music) +(source-play music) (source-play engine-sound) (define (update interval) @@ -295,67 +296,110 @@ (draw-sprite (vehicle-sprite player-car) (vehicle-position player-car) #:rotation player-rotation) (unless game-started? (let ((window-top (window-height (current-window)))) - (if show-credits? - (let ((left-margin 60) - (top-start 125) - (gap 25)) - (draw-text "TURBO RACER 3000!" - (vec2 left-margin (- window-top top-start)) - #:font the-font - #:scale (vec2 4 4) - #:color red) - (draw-text "DEVELOPMENT: Gene Pasquet" - (vec2 left-margin (- window-top (+ top-start gap))) - #:font the-font - #:scale (vec2 2 2)) - (draw-text "DESIGN: Owen Pasquet" - (vec2 left-margin (- window-top (+ top-start (* 2 gap)))) - #:font the-font - #:scale (vec2 2 2)) - (draw-text "PLAY TESTING: Owen Pasquet" - (vec2 left-margin (- window-top (+ top-start (* 3 gap)))) - #:font the-font - #:scale (vec2 2 2)) - (draw-text "MUSIC: Instrumental by Aries Beats" - (vec2 left-margin (- window-top (+ top-start (* 4 gap)))) - #:font the-font - #:scale (vec2 2 2)) - (draw-text "FONTS: Keshikan" - (vec2 left-margin (- window-top (+ top-start (* 5 gap)))) - #:font the-font - #:scale (vec2 2 2)) - (draw-text "SOUND: qubodup" - (vec2 left-margin (- window-top (+ top-start (* 6 gap)))) - #:font the-font - #:scale (vec2 2 2)) - (draw-text "BACK" - (vec2 250 (- window-top 330)) - #:font the-font - #:scale (vec2 2 2) - #:color yellow) - ) - (begin - ;; Draw the menu - (draw-text "TURBO RACER 3000!" - (vec2 60 (- window-top 125)) - #:font the-font - #:scale (vec2 4 4) - #:color red) - (draw-text "NEW GAME" - (vec2 250 (- window-top 250)) - #:font the-font - #:scale (vec2 2 2) - #:color (if (= menu-selection 0) yellow white)) - (draw-text "CREDITS" - (vec2 250 (- window-top 270)) - #:font the-font - #:scale (vec2 2 2) - #:color (if (= menu-selection 1) yellow white)) - (draw-text "QUIT" - (vec2 250 (- window-top 330)) - #:font the-font - #:scale (vec2 2 2) - #:color (if (= menu-selection 2) yellow white)))))) + (cond + (show-credits? + (let ((left-margin 60) + (top-start 125) + (gap 25)) + (draw-text "TURBO RACER 3000!" + (vec2 left-margin (- window-top top-start)) + #:font the-font + #:scale (vec2 4 4) + #:color red) + (draw-text "DEVELOPMENT: Gene Pasquet" + (vec2 left-margin (- window-top (+ top-start gap))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "DESIGN: Owen Pasquet" + (vec2 left-margin (- window-top (+ top-start (* 2 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "PLAY TESTING: Owen Pasquet" + (vec2 left-margin (- window-top (+ top-start (* 3 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "MUSIC: Instrumental by Aries Beats" + (vec2 left-margin (- window-top (+ top-start (* 4 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "FONTS: Keshikan" + (vec2 left-margin (- window-top (+ top-start (* 5 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "SOUND: qubodup" + (vec2 left-margin (- window-top (+ top-start (* 6 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "BACK" + (vec2 250 (- window-top 330)) + #:font the-font + #:scale (vec2 2 2) + #:color yellow))) + (show-help? + (let ((left-margin 60) + (top-start 125) + (gap 25)) + (draw-text "TURBO RACER 3000!" + (vec2 left-margin (- window-top top-start)) + #:font the-font + #:scale (vec2 4 4) + #:color red) + (draw-text "Complete 10miles fast!" + (vec2 left-margin (- window-top (+ top-start gap))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "Arrow keys or WASD control the car." + (vec2 left-margin (- window-top (+ top-start (* 2 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "ESCAPE for the main menu" + (vec2 left-margin (- window-top (+ top-start (* 3 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "" + (vec2 left-margin (- window-top (+ top-start (* 4 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "" + (vec2 left-margin (- window-top (+ top-start (* 5 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "" + (vec2 left-margin (- window-top (+ top-start (* 6 gap)))) + #:font the-font + #:scale (vec2 2 2)) + (draw-text "BACK" + (vec2 250 (- window-top 330)) + #:font the-font + #:scale (vec2 2 2) + #:color yellow))) + (else + ;; Draw the menu + (draw-text "TURBO RACER 3000!" + (vec2 60 (- window-top 125)) + #:font the-font + #:scale (vec2 4 4) + #:color red) + (draw-text "NEW GAME" + (vec2 250 (- window-top 250)) + #:font the-font + #:scale (vec2 2 2) + #:color (if (= menu-selection 0) yellow white)) + (draw-text "CREDITS" + (vec2 250 (- window-top 270)) + #:font the-font + #:scale (vec2 2 2) + #:color (if (= menu-selection 1) yellow white)) + (draw-text "HELP" + (vec2 250 (- window-top 290)) + #:font the-font + #:scale (vec2 2 2) + #:color (if (= menu-selection 2) yellow white)) + (draw-text "QUIT" + (vec2 250 (- window-top 350)) + #:font the-font + #:scale (vec2 2 2) + #:color (if (= menu-selection 3) yellow white)))))) (draw-sprite dash-7seg-background (vec2 270 0)) @@ -436,15 +480,21 @@ ((and (eq? key 'return) game-over?) (reset-game!)) ((and (eq? key 'return) (not game-started?)) - (if show-credits? - (set! show-credits? #f) - (cond - ((= menu-selection 0) - (reset-game!)) - ((= menu-selection 1) - (set! show-credits? #t)) - ((= menu-selection 2) - (abort-game))))))) + (cond + (show-credits? + (set! show-credits? #f)) + (show-help? + (set! show-help? #f)) + (else + (cond + ((= menu-selection 0) + (reset-game!)) + ((= menu-selection 1) + (set! show-credits? #t)) + ((= menu-selection 2) + (set! show-help? #t)) + ((= menu-selection 3) + (abort-game)))))))) (define (key-release key modifiers) (cond |