summaryrefslogtreecommitdiff
path: root/heyllama.scm
diff options
context:
space:
mode:
Diffstat (limited to 'heyllama.scm')
-rw-r--r--heyllama.scm19
1 files changed, 11 insertions, 8 deletions
diff --git a/heyllama.scm b/heyllama.scm
index dbe8833..faa6c0b 100644
--- a/heyllama.scm
+++ b/heyllama.scm
@@ -17,6 +17,9 @@
(size #:init-keyword #:size
#:getter get-size)
+ (draw-offset #:init-keyword #:draw-offset
+ #:getter get-draw-offset)
+
(vel #:init-value #v(0.0 0.0)
#:getter get-vel
#:setter set-vel!)
@@ -38,18 +41,17 @@
(sprite #:init-keyword #:sprite
#:getter get-sprite))
-(define (face-row dir)
- (if (> 0 dir)
- 4
- 12))
(define (draw-animal animal)
+
+ (define (face-row dir)
+ (if (> 0 dir) 4 12))
+
(draw-sprite (texture-atlas-ref (get-sprite animal)
(+ (face-row (get-face-direction animal))
(truncate (/ (get-animation-step animal) 4))))
- (get-screen-pos animal)))
-
-
+ (vec2- (get-screen-pos animal)
+ (get-draw-offset animal))))
;; -------------- Initial game state --------------
@@ -64,13 +66,14 @@
(set! llama (make <animal>
#:pos #v(200.0 200.0)
#:size #v(128.0 128.0)
+ #:draw-offset #v(15 12)
#:face-dir 1
#:sprite (split-texture (load-image "llama_walk.png")
80 80
#:spacing 48
#:margin 24)))
- (grid-add grid 'llama 200.0 200.0 80.0 80.0)
+ (grid-add grid 'llama 200.0 200.0 50.0 64.0)
(set! tile-map (load-tile-map "llama.tmx"))