From 41fef59b951d8a43d4f4c32b71fe93782f5d607f Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 6 Mar 2025 23:07:16 +0800 Subject: fix: delta becomes a boolean value in some case --- objects/Enemy.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'objects/Enemy.lua') diff --git a/objects/Enemy.lua b/objects/Enemy.lua index 017bc06..429b79a 100644 --- a/objects/Enemy.lua +++ b/objects/Enemy.lua @@ -52,7 +52,7 @@ function Enemy:moveTo(x, y, dt) local function getDelta(axis, destination, direction) -- delta is either +1 or -1, represents the direction - local delta = (self[axis] < destination and 1) or (self[axis] > destination and -1) + local delta = (self[axis] < destination and 1) or (self[axis] > destination and -1) or 0 -- check if the movement is blocked, if so delta is 0, meaning no movement local isBlocked = utils.isBlocked(self.body, self.x, self.y, direction, axis, dv*delta) -- cgit v1.2.3