diff --git a/game.scm b/game.scm index 7fbd3f4..fe1b7c8 100644 --- a/game.scm +++ b/game.scm @@ -341,7 +341,7 @@ (timeout update-callback dt)) (define update-callback (procedure->external update)) -;; Render loop +;; Rendering (define *current-effect* #f) (define (show-effect! effect) (set! *current-effect* effect) @@ -394,6 +394,17 @@ (117 .4) (137 .4) (157 .4)) +(define-animation anim:bomb-lit + (53 .4) + (73 .4) + (93 .4) + (113 .4)) +(define-animation anim:bomb-uh-oh + (54 .4) + (74 .4) + (94 .4) + (114 .4)) + (define number->string* (let ((cache (make-eq-hashtable))) ; assuming fixnums only @@ -460,7 +471,12 @@ (draw-tile context tileset (if on? 25 24) (vec2-x pos) (vec2-y pos))) (define (draw-bomb pos countdown) - (draw-tile context tileset (+ 51 countdown) (vec2-x pos) (vec2-y pos))) + (let ((x (vec2-x pos)) + (y (vec2-y pos))) + (match countdown + (-1 (draw-tile context tileset 50 x y)) + (1 (draw-animation context anim:bomb-uh-oh x y)) + (_ (draw-animation context anim:bomb-lit x y))))) (define (draw-gem pos) (draw-animation context anim:gem (vec2-x pos) (vec2-y pos))) @@ -632,7 +648,9 @@ (update-animation anim:ghost-gem dt) (update-animation anim:and-gate dt) (update-animation anim:or-gate dt) - (update-animation anim:xor-gate dt)) + (update-animation anim:xor-gate dt) + (update-animation anim:bomb-lit dt) + (update-animation anim:bomb-uh-oh dt)) (clear-rect context 0.0 0.0 *canvas-width* *canvas-height*) (set-transform! context 1.0 0.0 0.0 1.0 0.0 0.0) (scale! context *canvas-scale* *canvas-scale*)