tried and failed to implement player surrounding for enemies

This commit is contained in:
Derek
2024-07-21 15:22:43 -05:00
parent 58cf16ec41
commit a7b8613329
5 changed files with 10 additions and 6 deletions

View File

@@ -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

View File

@@ -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