summaryrefslogtreecommitdiffstats
path: root/net/ricketyspace
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2018-06-12 23:29:53 +0000
committerrsiddharth <s@ricketyspace.net>2018-06-12 23:31:21 +0000
commit1a2edc0ac797e0afc103411aee775f77cfc9975a (patch)
tree03d25b6a21614bf4d76512faf2b06af7703ce11c /net/ricketyspace
parent94d76800276532ad766c42fdb238e626a6ee1ac7 (diff)
net: ricketyspace/ror/six/snake: Show type 2 goo in red.
* net/ricketyspace/ror/six/snake.rkt (GOO-RED-IMG): New constant. (goo-list+scene): Update function. * net/ricketyspace/ror/six/resources/goo-red.gif: New file.
Diffstat (limited to 'net/ricketyspace')
-rw-r--r--net/ricketyspace/ror/six/resources/goo-red.gifbin0 -> 681 bytes
-rw-r--r--net/ricketyspace/ror/six/snake.rkt13
2 files changed, 9 insertions, 4 deletions
diff --git a/net/ricketyspace/ror/six/resources/goo-red.gif b/net/ricketyspace/ror/six/resources/goo-red.gif
new file mode 100644
index 0000000..bf767b1
--- /dev/null
+++ b/net/ricketyspace/ror/six/resources/goo-red.gif
Binary files differ
diff --git a/net/ricketyspace/ror/six/snake.rkt b/net/ricketyspace/ror/six/snake.rkt
index d894de5..24e5cea 100644
--- a/net/ricketyspace/ror/six/snake.rkt
+++ b/net/ricketyspace/ror/six/snake.rkt
@@ -21,6 +21,7 @@
(define MT-SCENE (empty-scene WIDTH-PX HEIGHT-PX))
(define GOO-IMG (bitmap "resources/goo.gif"))
+(define GOO-RED-IMG (bitmap "resources/goo-red.gif"))
(define SEG-IMG (bitmap "resources/body.gif"))
(define HEAD-IMG (bitmap "resources/head.gif"))
@@ -185,11 +186,15 @@
snake-body-scene))
(define (goo-list+scene goos scene)
- (define (get-posns-from-goo goos)
+ (define (get-posns-from-goo goos type)
(cond [(empty? goos) empty]
- [else (cons (goo-loc (first goos))
- (get-posns-from-goo (rest goos)))]))
- (img-list+scene (get-posns-from-goo goos) GOO-IMG scene))
+ [(= (goo-type (first goos)) type)
+ (cons (goo-loc (first goos))
+ (get-posns-from-goo (rest goos) type))]
+ [else (get-posns-from-goo (rest goos) type)]))
+ (img-list+scene (get-posns-from-goo goos 1) GOO-IMG
+ (img-list+scene (get-posns-from-goo goos 2)
+ GOO-RED-IMG scene)))
(define (img-list+scene posns img scene)
(cond [(empty? posns) scene]