Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help DrRacket Language: DrRacket-> Teaching Languages -> How to Design Programs -> Beginning Student How can I move all objects to different directions? (define

Need help DrRacket Language: DrRacket-> Teaching Languages -> How to Design Programs -> Beginning Student

How can I move all objects to different directions?

(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) (stop-when stop?)))

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

;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))))))

;If I don't put this it's exceed ram limit (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

More Books

Students also viewed these Databases questions

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago