bovido/scripts/get_random_top_cell_action.gd

14 lines
437 B
GDScript3
Raw Normal View History

2023-06-12 17:58:06 +02:00
class_name GetRandomTopCellAction
extends ActionLeaf
func tick(actor: Node, blackboard: Blackboard):
var rand_cell: Vector2i = actor.tile_map.get_random_top_cell()
actor.tile_map.set_cell(0, Vector2i(rand_cell.x, rand_cell.y), 1, Vector2i(0, 0), 0) # debug purpose
var destination = actor.tile_map.map_to_local(rand_cell)
destination.y += actor.Y_SPAWN_OFFSET
blackboard.set_value("destination", destination)
return SUCCESS