Tile Custom Data reseting for no reason

Godot Version 4.2

for x in tam_map.x:
	for y in tam_map.y:
		var tile : TileData = floresta.get_cell_tile_data(0, Vector2(x,y))
		var exploravel = false
		if x == 13 and y == 9:
			exploravel = true
		if x == 15 and y == 9:
			exploravel = true
		if x == 14 and y == 8:
			exploravel = true
		if x == 15 and y == 8:
			exploravel = true
		if x == 14 and y == 10:
			exploravel = true
		if x == 15 and y == 10:
			exploravel = true
		
		if exploravel:
			tile.set_custom_data("exploravel", true)
			expoHex.append(Vector2(x,y))
		else:
			tile.set_custom_data("exploravel", false)
			print("got here")`
			
print(expoHex)
		
for x in tam_map.x:
	for y in tam_map.y:
		var tile : TileData = floresta.get_cell_tile_data(0, Vector2(x,y))
		print(tile.get_custom_data("exploravel"))
		if tile.get_custom_data("exploravel") == true:
			print(Vector2(x,y))

Godot Exit:
(744) got here
[(13, 9), (14, 8), (14, 10), (15, 8), (15, 9), (15, 10)]
(750) false

Question

So I’m trying to make the custom data “exploravel” true for specific tiles, but the custom data remains false and I don’t know why, can someone explain to me what I’m doing wrong ?

I found the problem, I thought that TileData but in reality it refers to that entire set of tiles, so when I make a forest tile false, all forest tiles become false

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.