How can I get an array of areas overlapping with a tilemap and their grid coordinates?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By figroot

I am making checkers in godot (you can view it here) for structure I am using areas for the pieces and a Tlemap for the board.

Project Structure
The checkers are in groups (WCheck for white checkers, BCheck for black checkers) and the tilemap is in its own group. All of these nodes are children of the main node. I was thinking I could add a script to the tilemap which I could call via group to place the current layout of the board in a singleton so I can easily access it with a bot.

The Problem
Is it possible to get an array of areas overlapping a tilemap, and if so what would the syntax be to do this?

:bust_in_silhouette: Reply From: figroot

I have found a workaround

my structure is

root
|-board (tilemap)
|-W
||-all of the white checkers
|-B
||-all of the black checkers

I am using this code to check the positions of each checker against the board:

func get_board():
	b_peices_remaining = $B.get_child_count()
	w_peices_remaining = $W.get_child_count()

	var b_children = $B.get_children()
	for b_child in b_children:
		var position = b_child.get_position()
		var coord: Vector2 = $Board.world_to_map(position)

		if(b_child.is_in_group("Standard")):
			current_board[coord] = 2
		elif(b_child.is_in_group("King")):
			current_board[coord] = 4
		else:
			print("there is a weird checker at: ", coord)

	var w_children = $W.get_children()
	for w_child in w_children:
		var position = w_child.get_position()
		var coord: Vector2 = $Board.world_to_map(position)

		if(w_child.is_in_group("Standard")):
			current_board[coord] = 1
		elif(w_child.is_in_group("King")):
			current_board[coord] = 3
		else:
			print("there is a weird checker at: ", coord)