Add basic AND gate and electric switch.

This commit is contained in:
David Thompson 2024-05-22 08:00:39 -04:00
parent ff242fd1a5
commit 5756844161
5 changed files with 105 additions and 23 deletions

View file

@ -280,17 +280,25 @@
(define (draw-gate pos open?)
(draw-tile context tileset (if open? 46 45) (vec2-x pos) (vec2-y pos)))
(define (draw-and-gate pos)
(draw-tile context tileset 42 (vec2-x pos) (vec2-y pos)))
(define (draw-electric-switch pos on?)
(draw-tile context tileset (if on? 7 6) (vec2-x pos) (vec2-y pos)))
(define (draw-object obj)
(match obj
(#f #f)
(('player pos) (draw-player pos))
(('exit pos) #t) ; drawn via background
(('exit pos) #t) ; drawn via background
(('wall pos type) (draw-wall pos type))
(('block pos type) (draw-block pos type))
(('clock-emitter pos) #t) ; drawn via background
(('clock-emitter pos) #t) ; drawn via background
(('floor-switch pos on?) (draw-floor-switch pos on?))
(('gem pos) (draw-gem pos))
(('gate pos open?) (draw-gate pos open?))))
(('gate pos open?) (draw-gate pos open?))
(('and-gate pos) (draw-and-gate pos))
(('electric-switch pos on?) (draw-electric-switch pos on?))))
(define (draw-background)
(let* ((bv (level-background *level*))