Advertisement
juaniisuar

ej 4 p2

Apr 8th, 2016
366
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.79 KB | None | 0 0
  1. (define ALTO 350)
  2. (define ANCHO 400)
  3. (define AUTO .)
  4. (define MOV 30)
  5. (define INICIO (/ (image-width AUTO) 2))
  6.  
  7. (define (pantalla n) (place-image AUTO n (/ ALTO 2) (empty-scene ANCHO ALTO) ) )
  8. (define (incrementar n) (cond ((> n (- ANCHO INICIO)) n ) (else (+ n 3))))
  9. (define (tecla n k) (cond
  10.                       ((key=? k " ") INICIO)
  11.                       ((and (key=? k "right") (>= (- ANCHO (+ n INICIO)) MOV ))   (+ n MOV) )
  12.                       ((and (key=? k "left") (>= (- n INICIO) MOV ))   (- n MOV) )
  13.                       (else n)))
  14. (define (mouse-handler n x y event) (cond ( (string=? event "button-down" ) x ) (else n)))
  15.  
  16. (big-bang INICIO
  17.           (to-draw pantalla)
  18.           (on-tick incrementar)
  19.           (on-key tecla)
  20.           (on-mouse mouse-handler)
  21.           )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement