In the game im making when the player hits a tile I want the specific tile number to be recorded. So i have made the code:
pos = go.get_position()
x_tile = math.ceil(pos.x/16)
y_tile = math.ceil(pos.y/16)
tile = tilemap.get_tile("/level#Level_1", "level", x_tile, y_tile)
if not (self.last_tile == tile) then
print(tile)
self.last_tile = tile
end
When i hit the tile it printed out 84
So i wrote the code below which should remove the tile from the running game when i hit it. I’m not getting any errors but when my player hits the tile it just stays there? Have i coded it incorrectly?
if not (self.last_tile == tile) then
if tile == 84 then
tilemap.set_tile("/level#Level_1", "level", x_tile, y_tile, 0)
end
self.last_tile = tile
end
by doing some debugging i have found that instead if replacing the current tile 84 adds tile 0 one space above the tile 84. Do you know how i can change my code so tile 0 replaces tile 84 instead