From 68a116dc1a31313118360b66e3a1929f990b31e7 Mon Sep 17 00:00:00 2001 From: Martinsh Shaiters Date: Sat, 27 Jul 2013 16:11:12 +0300 Subject: [PATCH] Fix `multiway`'s behavior when dealing with zero-valued axis of `speed`. This fixes the behavior of `multiway` when `speed` is as an object with 0 value for either axis. Passing `{x: 0, y: 0}`, or variations of, is now safe. --- src/controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controls.js b/src/controls.js index 74ce311a..60de9981 100644 --- a/src/controls.js +++ b/src/controls.js @@ -726,7 +726,7 @@ Crafty.c("Multiway", { this._speed = { x: 3, y: 3 }; if (keys) { - if (speed.x && speed.y) { + if (speed.x !== undefined && speed.y !== undefined) { this._speed.x = speed.x; this._speed.y = speed.y; } else {