Tilemap Data set object question
Asked Answered
G

1

0

`extends TileMap

@export var gridSizeX : int
@export var gridSizeY : int

var dic = {}
var coords : Vector2
var is_Empty : bool

var NwborderX : int = 4
var NwborderY : int = 24

func _ready():

#PLACE GROUND TILES =====================================
for x in gridSizeX:
	for y in gridSizeY:
			
		dic[str(Vector2(x,y))] = {
			"Tile": "Ground",
			"Position": str(Vector2(x,y))
		}
		
		is_Empty = true
		set_cell(0, Vector2(x,y), 0, Vector2i(0,0), 0)
		#print(dic[Position], is_Empty)
		
#PLACE BORDER TILES ======================================
for i in NwborderX:
	for j in NwborderY:
		
		dic[str(Vector2(i,j))] = {
			"Tile": "Border",
			"Position": str(Vector2(i,j))
		}
		
		set_cell(0, Vector2(i -4,j -4), 1, Vector2i(0,0), 1)
		set_cell(0, Vector2(i + 20, j ), 1, Vector2i(0,0), 1)
		set_cell(0, Vector2(j - 4, i +20), 1, Vector2i(0,0), 1)
		set_cell(0, Vector2(j , i -4), 1, Vector2i(0,0), 1)


#PLACE HQ IN CENTRE =======================================
set_cell(2, Vector2(gridSizeX/2 - 3, gridSizeY/2 - 3), 2, Vector2i(0,0), 2)
#===========================================================
#TODO
#Is_Empty = false'

Hi, how can I set the cells (4x4) bool to true, with the HQ building ontop of them?
Many thanks.

Gonick answered 22/2 at 3:53 Comment(0)
W
0

Gonick You should be able to edit this while editing tiles, if I'm not mistaken? You just have to translate it to pixels. I want to say default is 32x32 - so 128x128?

Woollyheaded answered 22/2 at 20:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.