Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!