Add bomb animations.
This commit is contained in:
parent
a70f7f02da
commit
9398b550d7
1 changed files with 21 additions and 3 deletions
24
game.scm
24
game.scm
|
@ -341,7 +341,7 @@
|
||||||
(timeout update-callback dt))
|
(timeout update-callback dt))
|
||||||
(define update-callback (procedure->external update))
|
(define update-callback (procedure->external update))
|
||||||
|
|
||||||
;; Render loop
|
;; Rendering
|
||||||
(define *current-effect* #f)
|
(define *current-effect* #f)
|
||||||
(define (show-effect! effect)
|
(define (show-effect! effect)
|
||||||
(set! *current-effect* effect)
|
(set! *current-effect* effect)
|
||||||
|
@ -394,6 +394,17 @@
|
||||||
(117 .4)
|
(117 .4)
|
||||||
(137 .4)
|
(137 .4)
|
||||||
(157 .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*
|
(define number->string*
|
||||||
(let ((cache (make-eq-hashtable))) ; assuming fixnums only
|
(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)))
|
(draw-tile context tileset (if on? 25 24) (vec2-x pos) (vec2-y pos)))
|
||||||
|
|
||||||
(define (draw-bomb pos countdown)
|
(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)
|
(define (draw-gem pos)
|
||||||
(draw-animation context anim:gem (vec2-x pos) (vec2-y 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:ghost-gem dt)
|
||||||
(update-animation anim:and-gate dt)
|
(update-animation anim:and-gate dt)
|
||||||
(update-animation anim:or-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*)
|
(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)
|
(set-transform! context 1.0 0.0 0.0 1.0 0.0 0.0)
|
||||||
(scale! context *canvas-scale* *canvas-scale*)
|
(scale! context *canvas-scale* *canvas-scale*)
|
||||||
|
|
Loading…
Add table
Reference in a new issue