24 lines
717 B
GDScript
24 lines
717 B
GDScript
extends Node
|
|
|
|
var minions = []
|
|
var minion_nav_point = []
|
|
var number_minions : int
|
|
var rot_amount : float
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
minions = self.get_children()
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
for i in minions:
|
|
number_minions = minions.size()
|
|
rot_amount = deg_to_rad(360 / number_minions)
|
|
i.nav_agent.set_target_position(i.player.global_transform.origin)
|
|
var next_nav_point = i.nav_agent.get_next_path_position()
|
|
#var next_nav_point
|
|
#next_nav_point_start.rotate += rot_amount #times index
|
|
|
|
i.hive_velocity = (next_nav_point - i.global_transform.origin).normalized() * i.SPEED
|