0

When codeing a game i wanted the player to hit a specific tile and when hit the tile would be replaced with a dofferent tile with in the same tilemap. This is 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
        if tile == 84 then
            tilemap.set_tile("/level#Level_1", "level", x_tile, y_tile, 0)
        end 
        self.last_tile = tile
    end

When i play the project there are no errors

I'm trying to replace the tile with a clear tile so it looks like the tile has disappeared but when i tries the same idea but replacing it with a coloured tile it the coloured tile did'r replace but spawned ontop of the tile i wanted to replace? I have no idea why this is happening

Cyion
  • 1
  • 1
  • 1

0 Answers0