The following code gives the following error and I'm not sure why or what its implying. I'm using a square so think that there should only be eight neighbours but when I loop over just 8 I only get 4 neighbours returned.
Regards
E 0:00:01:0740 TilemapTest.gd:19 @ input(): Method/function failed. Returning: pcoords
<C++ Source> scene/2d/tilemap.cpp:3490 @ getneighbor_cell()
TilemapTest.gd:19 @ _input()
extends Node2D
var tilemap
func _ready():
tilemap = $TileMap
func input(event):
if event.isactionpressed("PlaceTile"):
var mouseposition = getglobalmouseposition()
var tile = tilemap.localtomap(mouseposition)
var checkCell = tilemap.getusedcells(0)
if !checkCell.has(tile):
var neighbors = []
for i in 16:
var getNeigbor = tilemap.getneighborcell(tile, i )
neighbors.append(getNeigbor)
for i in 16:
tilemap.setcell(0, neighbors[i], 0, Vector2i(0,0))
tilemap.setcell(0, tile, 1, Vector2i(0,0))
else:
print("Tile already here")