From 0764f57240efce7996070418000c56131fb22f62 Mon Sep 17 00:00:00 2001 From: Gene Pasquet Date: Wed, 22 May 2024 04:04:43 +0100 Subject: Add a nicer bitmap font --- Makefile | 4 + TODO.org | 15 ++++ thick_8x8.png | Bin 0 -> 1197 bytes thick_8x8.xml | 276 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ turbo.scm | 22 +++-- 5 files changed, 310 insertions(+), 7 deletions(-) create mode 100644 Makefile create mode 100644 thick_8x8.png create mode 100644 thick_8x8.xml diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..02961ea --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: play +play: + chickadee play turbo.scm + diff --git a/TODO.org b/TODO.org index e5f17e0..c70be0b 100644 --- a/TODO.org +++ b/TODO.org @@ -6,6 +6,21 @@ *** DONE Put van on random lane *** DONE Add multiple vehicles on different lanes *** TODO Ensure vehicles don't overlap + +Possible algorithm: + +#+begin_src +when car goes off-screen +go through all lanes +if lane has space, roll a die +if lucky + pick an inactive car + activate that car on the lane +#+end_src + +What happens if there are no cars on screen!? + => Force it? + ** TODO Detect collision with other vehicles ** TODO Add weapon to player car *** TODO Make weapon a power-up diff --git a/thick_8x8.png b/thick_8x8.png new file mode 100644 index 0000000..8f5fd09 Binary files /dev/null and b/thick_8x8.png differ diff --git a/thick_8x8.xml b/thick_8x8.xml new file mode 100644 index 0000000..78f80c8 --- /dev/null +++ b/thick_8x8.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/turbo.scm b/turbo.scm index c90052a..400146b 100644 --- a/turbo.scm +++ b/turbo.scm @@ -8,6 +8,8 @@ ;;;; Constants and variables +(define the-font (load-bitmap-font "thick_8x8.xml")) + (define lane-height 65) (define lane-length 192) (define road-start-y 80) @@ -184,11 +186,10 @@ (define (draw alpha) (draw-road road-section-position road-start-y road-num-lanes) - (draw-text "Turbo Racers!" - (vec2 260.0 (- (window-height (current-window)) 25))) - - (draw-text (format #f "Speed: ~smph" (* player-speed 5)) - (vec2 450.0 20.0)) + (draw-text "Turbo Racer 3000!" + (vec2 170.0 (- (window-height (current-window)) 25)) + #:font the-font + #:scale (vec2 2 2)) (draw-sprite player-car player-position #:rotation player-rotation) @@ -196,9 +197,16 @@ (if (vehicle-active? veh) (draw-sprite (vehicle-sprite veh) (vehicle-position veh)))) vehicles) - + + (draw-text (format #f "Speed: ~smph" (* player-speed 5)) + (vec2 450.0 20.0) + #:font the-font + #:scale (vec2 2 2)) + (if game-over - (draw-text "GAME OVER" (vec2 260 (/ (window-width (current-window)) 2))))) + (draw-text "GAME OVER" (vec2 260 (/ (window-width (current-window)) 2)) + #:font the-font + #:scale (vec2 2 2)))) (define (key-press key modifiers repeat?) -- cgit v1.2.3