cardel

Universe

Jun 22nd, 2016
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 1.25 KB | None | 0 0
  1. ;;https://docs.racket-lang.org/teachpack/2htdpimage.html#%28def._%28%28lib._2htdp%2Fimage..rkt%29._underlay%2Fxy%29%29
  2. ;;https://docs.racket-lang.org/teachpack/2htdpuniverse.html
  3. (require 2htdp/universe)
  4. (require 2htdp/image)
  5.  
  6. (define (create-UFO-scene height)
  7.   (underlay/xy (rectangle 200 200 "solid" "white") 100 height UFO))
  8.  
  9. (define (create-UFO-scene2 width)
  10.  (underlay/xy (rectangle 200 200 "solid" "white") width 100 UFO))
  11.  
  12.  
  13. (define UFO
  14.   (underlay/align "left"
  15.                   "bottom"
  16.                  
  17.                   (circle 30 "solid" "green")
  18.                   (circle 20 "solid" "red")
  19.                   (rectangle 40 4 "solid" "blue")))
  20.  
  21.  
  22.  
  23.  
  24. ;(create-UFO-scene 300)
  25. ;(create-UFO-scene 100)
  26. ;(animate create-UFO-scene)
  27. ;(animate create-UFO-scene2)
  28.  
  29.  
  30.  
  31. (define (create-bola-escena height)
  32.   (cond
  33.     [(< height 160)
  34.      (underlay/xy (rectangle 200 200 "solid" "white")
  35.               100 height bola)]
  36.     [else
  37.      (underlay/xy (rectangle 200 200 "solid" "white")
  38.               100 160 bola)
  39.     ]
  40.   )
  41.   )
  42. (define bola
  43.   (underlay/xy
  44.    (circle 10 "solid" "red")
  45.    20 0  
  46.    (underlay/xy
  47.     (circle 10 "solid" "yellow")
  48.     20 0
  49.     (circle 10 "solid" "green")
  50.     )
  51.    )
  52.   )
  53.  
  54. (animate create-bola-escena)
Add Comment
Please, Sign In to add comment