#reader(lib "htdp-beginner-reader.ss" "lang")((modname move-ball) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ())))
(define WIDTH 320)
(define HEIGHT 480)
(define RADIUS 5)
(define (tick w) w)
(define (move-ball w k)
(cond
[(key=? k 'up)
(make-posn (posn-x w) (- (posn-y w) 5))]
[(key=? k 'down)
(make-posn (posn-x w) (+ (posn-y w) 5))]
[(key=? k 'left)
(make-posn (- (posn-x w) 5) (posn-y w))]
[(key=? k 'right)
(make-posn (+ (posn-x w) 5) (posn-y w))]
[else
w]))
(define (draw-scene w)
(place-image (circle RADIUS "solid" "red")
(posn-x w)
(posn-y w)
(empty-scene WIDTH HEIGHT)))
(big-bang WIDTH HEIGHT (make-posn (/ WIDTH 2) (/ HEIGHT 2))
(on-tick 1 tick)
(on-redraw draw-scene)
(on-key move-ball))