From f3e6cd51c01207477910322a4d352cb75c1212df Mon Sep 17 00:00:00 2001 From: empathicqubit Date: Fri, 5 Mar 2021 16:12:59 -0500 Subject: [PATCH] Fix tile math --- game.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/game.lua b/game.lua index 7a7673a..3989345 100644 --- a/game.lua +++ b/game.lua @@ -260,13 +260,13 @@ function _M.getInputs() end for i = 1,#sprites do - distx = math.abs(sprites[i].x - (partyX+dx)) - disty = math.abs(sprites[i].y - (partyY+dy)) - if distx <= 8 and disty <= 8 then + distx = math.abs(sprites[i].x - (partyX+dx*TILE_SIZE)) + disty = math.abs(sprites[i].y - (partyY+dy*TILE_SIZE)) + if distx <= TILE_SIZE / 2 and disty <= TILE_SIZE / 2 then inputs[#inputs] = sprites[i].good local dist = math.sqrt((distx * distx) + (disty * disty)) - if dist > 8 then + if dist > TILE_SIZE / 2 then inputDeltaDistance[#inputDeltaDistance] = mathFunctions.squashDistance(dist) end end