18 lines
No EOL
471 B
GDScript
18 lines
No EOL
471 B
GDScript
extends Node
|
|
class_name GridUtilitiesClass
|
|
|
|
## Get the tile coordinates of the surrounding tiles of the given tile
|
|
func get_surrounding_tiles(given_tile : Vector2, spread : int = 3) -> Array:
|
|
var surrounding_tiles : Array[Vector2] = []
|
|
var target_tile : Vector2
|
|
|
|
for y in spread:
|
|
for x in spread:
|
|
target_tile = given_tile + Vector2(x - 1, y - 1)
|
|
|
|
#if given_tile == target_tile:
|
|
# continue
|
|
|
|
surrounding_tiles.append(target_tile)
|
|
|
|
return surrounding_tiles |