refactor(audit-M3): use engine.spatial.pixel_to_tile instead of math.floor
This commit is contained in:
3
init.lua
3
init.lua
@@ -72,8 +72,7 @@ local function can_occupy(x, y)
|
||||
{x + player.w - 1, y + player.h - 1},
|
||||
}
|
||||
for _, c in ipairs(corners) do
|
||||
local tx = math.floor(c[1] / ts)
|
||||
local ty = math.floor(c[2] / ts)
|
||||
local tx, ty = engine.spatial.pixel_to_tile(c[1], c[2], ts)
|
||||
if not maps.is_walkable(tx, ty) then return false end
|
||||
end
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user