Updated CRT enemy facing logic.

This commit is contained in:
Henry 2026-06-08 13:35:06 +01:00
parent c378433086
commit 7c037ed22c

View file

@ -47,28 +47,28 @@ func start(pos):
func _on_timer_timeout(): func _on_timer_timeout():
speed = randf_range(75, 100) speed = randf_range(75, 100)
$DirectionTimer.start() $DirectionTimer.start()
$ShootTimer.stop() # Stop shooting when changing direction
func _on_direction_timer_timeout(): func _on_direction_timer_timeout():
var move_direction = randi_range(0,2) var move_direction = randi_range(0,2)
match move_direction: match move_direction:
0: 0:
crt.frame = 0 crt.frame = 0 # down - facing
direction = Vector2(0,1) direction = Vector2(0,1)
can_shoot = true can_shoot = true
vulnerable = true $DirectionTimer.start()
#$DirectionTimer.start() $ShootTimer.start()
1: 1:
crt.frame = 1 crt.frame = 1 # right - facing right
direction = Vector2(1,0) direction = Vector2(1,0)
can_shoot = false can_shoot = false
vulnerable = false vulnerable = false
#$DirectionTimer.start() $DirectionTimer.start()
2: 2:
crt.frame = 2 crt.frame = 2 # left - facing left
direction = Vector2(-1,0) direction = Vector2(-1,0)
can_shoot = false can_shoot = false
vulnerable = false vulnerable = false
#$DirectionTimer.start() $DirectionTimer.start()
@ -82,7 +82,7 @@ func _on_shoot_timer_timeout():
$ShootTimer.start() $ShootTimer.start()
else: else:
$ShootTimer.start() $ShootTimer.stop() # Don't shoot when can_shoot is false - prevents timer race condition
func _process(delta): func _process(delta):
@ -132,7 +132,5 @@ func block():
shader_active = false shader_active = false
stunned = false stunned = false
$DirectionTimer.start() $DirectionTimer.start()
$ShootTimer.start() ## Restart shooting after stun period
print("CRT Not Stunned!") print("CRT Not Stunned!")