bovido/scripts/enemy/behavior_tree/move_to_destination_action.gd

23 lines
601 B
GDScript3
Raw Normal View History

2023-06-13 21:36:01 +02:00
class_name MoveToDestinationAction
extends ActionLeaf
func before_run(actor, blackboard):
var destination = blackboard.get_value("destination")
2023-07-01 13:26:45 +02:00
actor.flip_sprite(destination)
actor.play_walk_animation()
func tick(actor: Node, blackboard: Blackboard):
var destination = blackboard.get_value("destination")
2023-07-01 13:26:45 +02:00
actor.move_to(destination)
if actor.position == destination:
2023-07-01 18:56:45 +02:00
actor.next_destination = null
return SUCCESS
return RUNNING
func after_run(actor, blackboard):
2023-07-01 13:26:45 +02:00
actor.play_idle_animation()
# Debug
var destination = blackboard.get_value("destination")
2023-07-01 13:26:45 +02:00
actor.reset_tile(destination)