Hello, I've got problem with this piece of code that's supposed to find empty tiles by looping through the cells of a 32x32 tilemap:
const gridWidth = 32
const gridHeight = 32
var tilemap = get_parent().get_node("TileMap")
for x in range(gridWidth):
for y in range(gridHeight):
var tile_index = tilemap.get_cell(gridWidth, gridHeight)
The tile_index variable always ends up with the value of 1, even though I've got plenty of other type of tiles, also empty ones.
However if I print try printing tile indexes with constant values like this:
Then it prints the correct -1 value.
What could be the problem?