Swarm/MovementBehaviour/Prefabs/MovementBehaviourPillbug.gd

14 lines
371 B
GDScript3
Raw Normal View History

2024-03-04 16:04:40 +01:00
extends MovementBehaviour
class_name MovementBehaviourPillbug
func get_available_spaces(pos: Vector4i, map: HexGrid) -> Array[Vector4i]:
var potential_spaces = map.get_empty_neighbours(pos)
var target_spaces: Array[Vector4i] = []
for neighbour in potential_spaces:
if map.can_reach(pos, neighbour):
target_spaces.append(neighbour)
return target_spaces