fixed attack in state machine

This commit is contained in:
Derek
2025-04-21 22:58:54 -05:00
parent 18398e8d4e
commit 362b0a5708
8 changed files with 54 additions and 14 deletions

View File

@@ -20,7 +20,7 @@ func randomize_wander():
func randomize_turret_scan():
scan_direction = randf_range(-TURRET_TURN_AMT,TURRET_TURN_AMT)
scan_time = randf_range(1,3)
scan_time = randf_range(5,10)
func _Enter():
randomize_wander()
@@ -47,4 +47,7 @@ func Physics_Update(delta : float):
var look_target = enemy.spider_look_next.global_rotation.y
enemy.global_rotation.y = lerp(enemy.global_rotation.y,look_target,delta * 3)
enemy.turret.rotation.y = lerp(enemy.turret.rotation.y,deg_to_rad(scan_direction),delta)
enemy.turret_look.rotation.y = lerp(enemy.turret_look.rotation.y,deg_to_rad(scan_direction),delta)
if enemy.turret_look.is_colliding() and enemy.turret_look.get_collider() is Player:
Transitioned.emit(self,"attack")