bovido/scripts/enemy/behavior_tree/get_random_target_action.gd

13 lines
318 B
GDScript

class_name GetRandomTargetAction
extends ActionLeaf
func tick(actor, blackboard):
var rand_cell: Vector2i = actor.tile_map.get_random_bottom_cell()
actor.tile_map.reset_and_set_target_cell(rand_cell)
var target = actor.tile_map.map_to_local(rand_cell)
blackboard.set_value("target", target)
return SUCCESS