From 1a2edc0ac797e0afc103411aee775f77cfc9975a Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Tue, 12 Jun 2018 23:29:53 +0000 Subject: 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. --- net/ricketyspace/ror/six/resources/goo-red.gif | Bin 0 -> 681 bytes net/ricketyspace/ror/six/snake.rkt | 13 +++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 net/ricketyspace/ror/six/resources/goo-red.gif 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 Binary files /dev/null and b/net/ricketyspace/ror/six/resources/goo-red.gif 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] -- cgit v1.2.3