1 (set-game-properties! #:title "Gacela Asteroids")
4 (let ((asteroid (load-texture "Asteroid.png")))
7 (translate (car a) (cadr a))
8 (draw-texture asteroid))))
10 (define (move-asteroid a)
11 (let* ((x (car a)) (y (cadr a))
12 (vx (caddr a)) (vy (cadddr a))
13 (nx (+ x vx)) (ny (+ y vy)))
14 (cond ((> nx 320) (set! vx -1))
15 ((< nx -320) (set! vx 1)))
16 (cond ((> ny 240) (set! vy -1))
17 ((< ny -240) (set! vy 1)))
18 (list (+ x vx) (+ y vy) vx vy)))
20 (let ((asteroids '((100 100 1 1) (-100 -100 -1 1))))
22 (set! asteroids (map move-asteroid asteroids))
23 (for-each draw-asteroid asteroids)))