From: Javier Sancho Date: Tue, 15 May 2012 19:02:06 +0000 (+0200) Subject: Guybrush moves with cursors left and right X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=8c11779c29d94a8c7702aae0964180252638dc10;p=gacela.git Guybrush moves with cursors left and right --- diff --git a/games/guybrush/guybrush.scm b/games/guybrush/guybrush.scm index 967c4de..66e58e3 100644 --- a/games/guybrush/guybrush.scm +++ b/games/guybrush/guybrush.scm @@ -10,10 +10,14 @@ (define-mob (guybrush (guy (load-texture "guybrush.png")) (x 0) - (y (- (/ (assoc-ref (get-game-properties) 'height) 2)))) + (y (+ (- (/ (assoc-ref (get-game-properties) 'height) 2)) + (/ (assoc-ref (get-texture-properties guy) 'height) 2)))) + + (cond ((key? 'left) (set! x (- x 10)))) + (cond ((key? 'right) (set! x (+ x 10)))) + (translate x y) (draw-texture guy)) (show-mob (guybrush)) -;; Tengo que hacer una función para obtener propiedades de textura en video.scm \ No newline at end of file