Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In code when I press d one of the objects should disappear and when I press d 4 times all will be gone. I tried

In code when I press "d" one of the objects should disappear and when I press "d" 4 times all will be gone. I tried to change their color "white" but I couldn't. I need help about that part. Language: DrRacket -> Teaching Languages -> How to Design Programs -> Beginning Student

(define color1 "red") (define color2 "blue") (define color3 "purple") (define color4 "green") (define s1 (square 80 "solid" color1)) (define s2 (circle 100 "solid" color2)) (define s3 (circle 90 "solid" color3)) (define s4 (square 100 "solid" color4))

(define (main x) (big-bang x (on-tick next) (to-draw draw-world) (on-mouse restart) ;(on-key remove1) (stop-when stop?)))

;when click restart (define (restart w x y me) (cond ((mouse=? me "button-down") 0) (else w)))

;when press d remove 1

;to move s1, s2, s3, s4 (define (next world) (cond [(>= world 1000) world] [else (+ world 1)]))

(define (draw-world world ) (place-image s1 world 250 (place-image s2 world 50 (place-image s3 700 world (place-image s4 500 world (empty-scene 800 800))))))

;to stop when all objects gone (define (stop? world) (= world 1000))

(main 1)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions