ft: nucleotide prey FSM

This commit is contained in:
djaidjai committed 2026-01-26 23:54:15 +01:00
1 parent c11afd9ddd
commit adf1438bc8
18 files changed
+121 -45

No files matched your search

@@ -0,0 +1,20 @@
extends State
@onready var timer = $Timer
var dir: Vector3 = Vector3(0,0,0);
func enter(previous_state_path: String, data := {}) -> void:
timer.start((float)(randi() % 10)/20)
dir = calc_dir(randi() % 360)
func physics_update(_delta: float) -> void:
owner.move(dir)
func calc_dir(angle: float) -> Vector3:
return Vector3(cos(angle), sin(angle), 0)
func _on_timer_timeout() -> void:
finished.emit(owner.fsm.States.IDLE, {})
func exit() -> void:
timer.stop()
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.