In the game i’m working on i’ve made a function that will log which tile the player is standing on and output it into the colsole.
the code looks like this:
pos = go.get_position()
x_tile = math.ceil(pos.x/16)
y_tile = math.ceil(pos.y/16)
tile = tilemap.get_tile("main#level1#tilemap", "level", x_tile, y_tile)
if not (self.last_tile == tile) then
print(tile)
self.last_tile = tile
end
For some reason i’m getting the following error:
For reference this is where the tilemap is located in my project: