Make slugs renavigate every second

main
Olivier 'reivilibre' 2023-01-09 03:33:17 +00:00
parent 412a151d45
commit 4f85a9bfcc
2 changed files with 9 additions and 0 deletions

View File

@ -126,3 +126,8 @@ func _on_NavigationAgent2D_target_reached() -> void:
print("reached distsq = ", dsq)
if dsq < 256:
self._at_target()
func _on_RenavigateTimer_timeout() -> void:
if target != null:
_agent.set_target_location(target.global_position)

View File

@ -50,4 +50,8 @@ path_max_distance = 64.0
[node name="SlimyWalkSfx" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 8 )
[node name="RenavigateTimer" type="Timer" parent="."]
autostart = true
[connection signal="target_reached" from="NavigationAgent2D" to="." method="_on_NavigationAgent2D_target_reached"]
[connection signal="timeout" from="RenavigateTimer" to="." method="_on_RenavigateTimer_timeout"]