diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-06 23:07:16 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-06 23:07:16 +0800 |
| commit | 41fef59b951d8a43d4f4c32b71fe93782f5d607f (patch) | |
| tree | 333c854d4b0367d51320bf91faaba9b035258c30 /objects/Enemy.lua | |
| parent | 4be7c993013fc91d0956454149c769abdee68f81 (diff) | |
fix: delta becomes a boolean value in some case
Diffstat (limited to 'objects/Enemy.lua')
| -rw-r--r-- | objects/Enemy.lua | 2 |
1 files changed, 1 insertions, 1 deletions
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) |
