Fixed chase states
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
@abstract
|
||||
class_name CultistChaseState
|
||||
extends CultistMoveState
|
||||
|
||||
@@ -13,7 +14,11 @@ func physics_process(delta: float) -> void:
|
||||
if player != null:
|
||||
cultist.target_x = player.position.x
|
||||
|
||||
if is_equal_approx(cultist.position.x, cultist.target_x):
|
||||
if _is_target_reached() or _wall_ray_cast.is_colliding():
|
||||
switch_state.emit(look_around_state)
|
||||
else:
|
||||
cultist.update_x_velocity(_direction, cultist.MAX_CHASE_SPEED, delta)
|
||||
|
||||
|
||||
@abstract
|
||||
func _is_target_reached() -> bool
|
||||
|
||||
Reference in New Issue
Block a user