bovido/scripts/enemy/behavior_tree/throw_ball_action.gd
Mathilde Grapin e0633efcbe Play ball with the enemy
Enemy can return the ball to the player
2023-06-27 21:25:32 +02:00

18 lines
404 B
GDScript

class_name ThrowBallAction
extends ActionLeaf
func before_run(actor, _blackboard):
actor.play_throw_animation()
func tick(actor, blackboard):
if !actor.is_throw_animation_finished:
return RUNNING
else:
var target = blackboard.get_value("target")
actor.throw_ball(target)
actor.has_thrown_ball = true
return SUCCESS
func after_run(actor, _blackboard):
actor.animation_player.play("idle")