Godot Version
4.3
Question
I’m following a youtube tutorial for procedural generation with autotile. I’ve created a 2d node (World) with a Tilemap Layer (“Tilemap”) child node.
I’ve attached a script to the world node:
extends Node2D
@onready var tilemap = $Tilemap
const MAP_SIZE = Vector2(128,128)
const LAND_CAP = 0.3
func _ready():
make_world()
func make_world():
var noise = FastNoiseLite.new()
noise.seed = 100
var cells = []
for x in MAP_SIZE.x:
for y in MAP_SIZE.y:
var a = noise.get_noise_2d(x, y)
if a < LAND_CAP:
cells.append(Vector2(x,y))
tilemap.set_cells_terrain_connect(0, cells, 0, 0)
But when I try to test it, I get the following error:
Invalid type in function ‘set_cells_terrain_connect’ in base ‘TileMapLayer’. Cannot convert argument 2 from Array to int.
I’ve tried changing Vetctor2 to Vector2i. I’ve also tried initializing the var cells empty array as a Vector2i.
I’d greatly appreciate any help you could offer, thank you!