Fix tile math
This commit is contained in:
parent
8da9feb56b
commit
f3e6cd51c0
1 changed files with 4 additions and 4 deletions
8
game.lua
8
game.lua
|
@ -260,13 +260,13 @@ function _M.getInputs()
|
||||||
end
|
end
|
||||||
|
|
||||||
for i = 1,#sprites do
|
for i = 1,#sprites do
|
||||||
distx = math.abs(sprites[i].x - (partyX+dx))
|
distx = math.abs(sprites[i].x - (partyX+dx*TILE_SIZE))
|
||||||
disty = math.abs(sprites[i].y - (partyY+dy))
|
disty = math.abs(sprites[i].y - (partyY+dy*TILE_SIZE))
|
||||||
if distx <= 8 and disty <= 8 then
|
if distx <= TILE_SIZE / 2 and disty <= TILE_SIZE / 2 then
|
||||||
inputs[#inputs] = sprites[i].good
|
inputs[#inputs] = sprites[i].good
|
||||||
|
|
||||||
local dist = math.sqrt((distx * distx) + (disty * disty))
|
local dist = math.sqrt((distx * distx) + (disty * disty))
|
||||||
if dist > 8 then
|
if dist > TILE_SIZE / 2 then
|
||||||
inputDeltaDistance[#inputDeltaDistance] = mathFunctions.squashDistance(dist)
|
inputDeltaDistance[#inputDeltaDistance] = mathFunctions.squashDistance(dist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue