chore: adjusted animations and tree logic

This commit is contained in:
Sara Gerretsen 2026-03-15 10:44:41 +01:00
parent 5214b60ff0
commit a02f00c7a2
3 changed files with 5 additions and 4 deletions

View file

@ -11,10 +11,11 @@ func _enter():
anim_started = false
anim.play(attack_name, .0)
anim.advance(0)
return Running
func _execute() -> int:
if anim.current_animation == attack_name:
anim_started = true
elif anim_started:
return Success if body.attack_queued else Fail
return Success
return Running

View file

@ -2,7 +2,7 @@ extends BehaviourAction
@onready var body := owner
func _execute() -> int:
func _enter() -> int:
if body.attack_queued:
body.attack_queued = false
return Success

View file

@ -52,7 +52,7 @@ func _unhandled_input(event : InputEvent):
input.x = Input.get_axis(\"move_left\", \"move_right\")
get_viewport().set_input_as_handled()
func _execute() -> int:
func _enter() -> int:
if input.is_zero_approx():
return Fail
var camera_basis : Basis = get_viewport().get_camera_3d().global_basis
@ -70,7 +70,7 @@ func _execute() -> int:
resource_name = "PlayerIdle"
script/source = "extends BehaviourAction
func _execute() -> int:
func _enter() -> int:
get_behaviour_tree().get_node(\"%AnimationPlayer\").play(\"ready\", .1)
(owner as CharacterBody3D).velocity = Vector3()
return Success