Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | dogman | |
Old Version | Published before Godot 3 was released. |
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)
print(tile_index)
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:
print(tilemap.get_cell(7,9));
Then it prints the correct -1 value.
What could be the problem?