Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;constants
- (define HEIGHT 200)
- (define WIDTH 400)
- (define SCENE
- (empty-scene WIDTH HEIGHT "blue"))
- (define GROUND
- (rectangle WIDTH 10 "solid" "brown"))
- (define ROCKET
- (overlay (circle 10 "solid" "green")
- (rectangle 40 4 "solid" "green")))
- (define ROCKET-CENTER-TO-TOP
- (- (- HEIGHT 10)
- (/ (image-height ROCKET) 2)))
- ;functions
- (define (pic-rocket h)
- (cond
- ((<= h ROCKET-CENTER-TO-TOP)
- (place-image ROCKET (/ WIDTH 2) h
- (place-image GROUND (/ WIDTH 2) HEIGHT SCENE)))
- ((> h ROCKET-CENTER-TO-TOP)
- (place-image ROCKET (/ WIDTH 2) ROCKET-CENTER-TO-TOP
- (place-image GROUND (/ WIDTH 2) HEIGHT SCENE)))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement