Mathilde Grapin
1aed988149
Add the Beehave addon. Make the enemy do the same thing as before but with a behavior tree.
12 lines
370 B
GDScript
12 lines
370 B
GDScript
class_name GetRandomTopCell
|
|
extends ActionLeaf
|
|
|
|
func tick(actor, _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
|
|
|
|
actor.destination = actor.tile_map.map_to_local(rand_cell)
|
|
actor.destination.y += actor.y_spawn_offset
|
|
|
|
return SUCCESS
|