diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2018-07-22 14:05:59 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2018-07-27 17:15:47 +0200 |
commit | 25061aee05d41254735b46298693326ca4d46a44 (patch) | |
tree | e8444f32544ef0bbf989af5766dacb9d02d32075 /scenes | |
parent | 6f04ad781d5588b5f56490275b4d6ae0ad3a8a8b (diff) |
Move "walk" procedure to characters module.
Diffstat (limited to 'scenes')
-rw-r--r-- | scenes/game.scm | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/scenes/game.scm b/scenes/game.scm index ea3da09..d1500ff 100644 --- a/scenes/game.scm +++ b/scenes/game.scm @@ -48,32 +48,6 @@ (define-class <stats> (<node-2d>) (object #:accessor object #:init-form #f #:init-keyword #:object)) -(define-method (walk (character <character>) directions . rest) - (unless (equal? (direction character) directions) - (let ((sprite (child-ref character 'sprite)) - (speed (if (member 'stop rest) 0.0 (walk-speed character)))) - (change-animation sprite (last directions)) - (for-each (lambda (dir) - (case dir - ((right) - (set-vec2-x! (velocity character) speed)) - ((left) - (set-vec2-x! (velocity character) (* -1.0 speed))) - ((up) - (set-vec2-y! (velocity character) speed)) - ((down) - (set-vec2-y! (velocity character) (* -1.0 speed))) - ((idle) - (set-vec2-x! (velocity character) 0.0) - (set-vec2-y! (velocity character) 0.0) - (change-animation sprite (case (last (direction character)) - ((right) 'idle-right) - ((left) 'idle-left) - ((up) 'idle-back) - ((down) 'idle-front)))))) - directions) - (set! (direction character) directions)))) - (define-asset test-map (load-tile-map "assets/maps/01.tmx")) |