tried and failed to implement player surrounding for enemies
This commit is contained in:
@@ -14,8 +14,10 @@ func _ready():
|
||||
func _process(delta):
|
||||
for i in minions:
|
||||
number_minions = minions.size()
|
||||
rot_amount = 360 / number_minions
|
||||
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
|
||||
|
||||
@@ -77,14 +77,16 @@ func _process(delta):
|
||||
distance_to_player = abs(self.global_position - player.global_position)
|
||||
|
||||
|
||||
if distance_to_player.x > 4 or distance_to_player.z > 4:
|
||||
move_and_slide()
|
||||
#if distance_to_player.x > 4 or distance_to_player.z > 4:
|
||||
move_and_slide()
|
||||
|
||||
|
||||
func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
health -= dam * bullet_damage
|
||||
print("health: " + str(health))
|
||||
if health <= 0:
|
||||
#remove from parent array
|
||||
get_parent().minions.erase(self)
|
||||
|
||||
particlespawn = die_particles.instantiate()
|
||||
particlespawn.position = self.global_position
|
||||
|
||||
Reference in New Issue
Block a user