im having a problem figuring out what tile is next to player.
i need to figure out if a tile right, left, up or down to the player is for ex. a wall or a water tile.
ive tried everything i could think of but it just wont work. here is what im doing right now:
Code: Select all
for k, v in ipairs(painter.tiles) do
if v.x/tilesize == math.floor(player.x/tilesize) and v.y == math.floor(player.y/tilesize)-1 then
if v.name == "water" then
print("water")
end
end
end
here is my .love file, hope anyone could be of help. thanks in advance. press space to do the tile check.