class_name MoveToTargetAction extends ActionLeaf func before_run(actor, blackboard): var destination = blackboard.get_value("destination") actor.sprite.flip_h = actor.position.x > destination.x actor.animation_player.play("walk") func tick(actor: Node, blackboard: Blackboard): var destination = blackboard.get_value("destination") var delta = get_physics_process_delta_time() actor.position = actor.position.move_toward(destination, delta * actor.speed) if actor.position == destination: return SUCCESS return RUNNING