Fix animation bug

This commit is contained in:
2021-01-03 18:54:05 -07:00
parent 53f0da0f46
commit 4300b70600

View File

@@ -20,8 +20,8 @@
(set up (set down false))) (set up (set down false)))
(when (and left right) (when (and left right)
(set left (set right false))) (set left (set right false)))
(when (or up down left right) (if (or up down left right)
(deflocal &mut :Float newAngle 0) (let [&mut :Float newAngle 0]
(cond (cond
(up (up
(set newAngle -90) (set newAngle -90)
@@ -46,7 +46,10 @@
(set newAngle 0) (set newAngle 0)
(set facing FlxObject.RIGHT))) (set facing FlxObject.RIGHT)))
(velocity.set SPEED 0) (velocity.set SPEED 0)
(velocity.rotate (FlxPoint.weak 0 0) newAngle))) (velocity.rotate (FlxPoint.weak 0 0) newAngle))
(when animation.curAnim
(set animation.curAnim.curFrame 0)
(animation.curAnim.pause)))
// TODO != is not implemented. Not sure how it would work as a variadic, because other // TODO != is not implemented. Not sure how it would work as a variadic, because other
// Lisps don't have that either // Lisps don't have that either
(when !(and (= 0 velocity.x) (= 0 velocity.y)) (when !(and (= 0 velocity.x) (= 0 velocity.y))
@@ -59,7 +62,7 @@
(animation.play "d")) (animation.play "d"))
(otherwise (otherwise
(return)))) (return))))
(return)) (return)))
(defmethod &override update [:Float elapsed] (defmethod &override update [:Float elapsed]
(updateMovement) (updateMovement)