Created
July 1, 2018 10:20
-
-
Save shakdwipeea/0f0a89565d2efadc673a8ecee3789b91 to your computer and use it in GitHub Desktop.
move ufo and tank
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (require 2htdp/image) | |
| (require 2htdp/universe) | |
| (require lang/posn) | |
| (struct world (ufo tank)) | |
| (define width 500) | |
| (define height 500) | |
| (define mtsn (empty-scene width height)) | |
| (define ufo (circle 10 "solid" "red")) | |
| (define tank (overlay/xy | |
| (overlay/xy (circle 5 "solid" "black") 20 0 (circle 5 "solid" "black")) | |
| 0 | |
| -8 | |
| (overlay/xy (rectangle 30 8 "solid" "red") 7 -4 (rectangle 15 4 "solid" "red")))) | |
| (define (render w) | |
| (place-images | |
| (list ufo tank) | |
| (list (make-posn 50 (world-ufo w)) | |
| (make-posn (world-tank w) 200)) | |
| mtsn)) | |
| (define (animate w) | |
| (world (+ 1 (world-ufo w)) | |
| (+ 1 (world-tank w)))) | |
| (define (main p0) | |
| (big-bang p0 | |
| [on-tick animate] | |
| [to-draw render])) | |
| (main (world 200 100)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment