Working on enemy hivemind, it's doing *something* now
This commit is contained in:
@@ -12,12 +12,20 @@ func _ready():
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
#calculate move position for each child
|
||||
for i in minions:
|
||||
#by number of minions determine the amount they should rotate around the player to be evenly distributed
|
||||
number_minions = minions.size()
|
||||
rot_amount = deg_to_rad(360 / number_minions)
|
||||
i.nav_agent.set_target_position(i.player.global_transform.origin)
|
||||
|
||||
#return current array index
|
||||
var minion_rot_amount = minions.find(i) * deg_to_rad(360 / number_minions)
|
||||
var minion_pos = i.global_transform.origin
|
||||
var player_pos = i.player.global_transform.origin - Vector3(4,0,0)
|
||||
var nav_pos : Vector3
|
||||
nav_pos.x = player_pos.x + (minion_pos.x-player_pos.x)*cos(minion_rot_amount) - (minion_pos.x-player_pos.x)*sin(minion_rot_amount)
|
||||
nav_pos.z = player_pos.z + (minion_pos.z-player_pos.z)*sin(minion_rot_amount) - (minion_pos.z-player_pos.z)*cos(minion_rot_amount)
|
||||
|
||||
i.nav_agent.set_target_position(nav_pos)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user