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
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue