X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=games%2Fasteroids%2Fasteroids.scm;fp=games%2Fasteroids%2Fasteroids.scm;h=a0268f8e69a71ba76f5b083b73eea5e90882e10a;hb=60ba345268e2b5c90d4ace172bf6ad1be53520e2;hp=2a3ea039ffaaa8e5e277f20fcfd0374ae4391ae8;hpb=8d9d9e6ef939fbfc939cdd5c86a31a7ca919899e;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))