Add first draft of tutorial levels.

This commit is contained in:
David Thompson 2024-05-24 12:09:26 -04:00
parent 0b5c86aa21
commit 23f034a868
10 changed files with 514 additions and 24 deletions

View file

@ -29,6 +29,12 @@
(game audio)
(game effects)
(game level)
(game levels tutorial-1)
(game levels tutorial-2)
(game levels tutorial-3)
(game levels tutorial-4)
(game levels tutorial-5)
(game levels tutorial-6)
(game levels level-1)
(game levels level-2)
(game levels level-3)
@ -90,8 +96,14 @@
(define levels
(vector
load-level-1
load-level-2
load-tutorial-1
load-tutorial-2
load-tutorial-3
load-tutorial-4
load-tutorial-5
load-tutorial-6
;; load-level-1
;; load-level-2
load-level-3
load-level-4))
(define *level-idx* #f)
@ -425,8 +437,11 @@
(for-each draw-object *objects*)
(let ((alive? (with-goblins ($ (level-player *level*) 'alive?))))
(unless alive?
(set-fill-color! context "rgba(0,0,0,0.65)")
(set-global-alpha! context 0.7)
(set-fill-color! context "#222034")
(fill-rect context 0.0 0.0 game-width game-height)
(set-global-alpha! context 1.0)
(set-font! context "normal 32px monogram")
(set-fill-color! context "#ffffff")
(set-text-align! context "center")
(fill-text context "OUCH... x_x" (/ game-width 2.0) (/ game-height 2.0)))))
@ -527,8 +542,16 @@
;; REMOVE BEFORE RELEASE!!!!
((string=? key key:confirm)
(next-level!))))
;; Pressing any key resets the game.
('win (reset-game!)))))
;; Pressing any bound key resets the game.
('win
(when (or
(string=? key key:left)
(string=? key key:right)
(string=? key key:up)
(string=? key key:down)
(string=? key key:undo)
(string=? key key:confirm))
(reset-game!))))))
;; Canvas and event loop setup
(define canvas (get-element-by-id "canvas"))