From: jsancho Date: Tue, 13 Sep 2011 19:22:55 +0000 (+0000) Subject: (no commit message) X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=60ba345268e2b5c90d4ace172bf6ad1be53520e2;p=gacela.git --- diff --git a/games/asteroids/asteroids.scm b/games/asteroids/asteroids.scm index 2a3ea03..a0268f8 100644 --- a/games/asteroids/asteroids.scm +++ b/games/asteroids/asteroids.scm @@ -7,21 +7,21 @@ (define-mob (asteroid (image (load-texture "Asteroid.png")) - (x 0) (y 0) (angle 0)) + (x 0) (y 0) (angle 0) + (vx 1) (vy 1)) + (set! x (+ x vx)) + (set! y (+ y vy)) + (cond ((> x max-x) (set! vx -1)) + ((< x min-x) (set! vx 1))) + (cond ((> y max-y) (set! vy -1)) + ((< y min-y) (set! vy 1))) + (translate x y) (rotate angle) (draw-texture image)) (show-mob (make-asteroid)) -;; (define draw-asteroid -;; (let ((asteroid (load-texture "Asteroid.png"))) -;; (lambda (a) -;; (to-origin) -;; (translate (assoc-ref a 'x) (assoc-ref a 'y)) -;; (rotate (assoc-ref a 'angle)) -;; (draw-texture asteroid)))) - ;; (define (move-asteroid a) ;; (let ((x (assoc-ref a 'x)) (y (assoc-ref a 'y)) ;; (angle (assoc-ref a 'angle))