- Edited
I’m trying to change tiles in a tile map with code, I know how to do it with $TileMap.set_cell() but how do I get it to auto tile? I've tried using $TileMap.set_cells_terrain_connect() but have been unable to get it to work.
This is my code:
#I start by running a function with a 2d array with values on each tile(I've used this with #$TileMap.set_cells_terrain_connect() so I know this works as intended)
#this is the code in the “Data” script:
var tile_types = {
"void":-1,
"water":2,
"grass":1,
"forest":3,
"sand":0
}
#In my Tilemap script:
for x in range(0,new.size()):
for y in range(0,new[0].size()):
$TileMap.set_cells_terrain_connect(0, Vector2i(x,y), 0, Data.tile_types[new[0][0]["name"]],true)
Any ideas as to what I am doing wrong?