From fa17fd85108aa349d26cb95d540ad0ba837ba32a Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Mon, 29 Jun 2020 19:22:15 -0400 Subject: fourteen: server.rkt: Update eat-all-the-things Make a new cupcake appear on the screen every other time one is eaten. --- net/ricketyspace/ror/fourteen/server.rkt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net') diff --git a/net/ricketyspace/ror/fourteen/server.rkt b/net/ricketyspace/ror/fourteen/server.rkt index c1d1e92..e551b2f 100644 --- a/net/ricketyspace/ror/fourteen/server.rkt +++ b/net/ricketyspace/ror/fourteen/server.rkt @@ -279,11 +279,13 @@ The server is responsible for: ;; determine left-over foods (define (eat-all-the-things player foods) (define b (ip-body player)) + (define (new-cupcake) + (create-a-body CUPCAKE)) (for/fold ([foods '()]) ([f foods]) (cond [(body-collide? f b) (set-body-size! b (+ PLAYER-FATTEN-DELTA (body-size b))) - foods] + (cons (new-cupcake) foods)] [else (cons f foods)]))) ;; body body -> Boolean -- cgit v1.2.3