diff options
Diffstat (limited to 'Scenes/Utilities.gd')
-rw-r--r-- | Scenes/Utilities.gd | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Scenes/Utilities.gd b/Scenes/Utilities.gd index 87c3539..092e853 100644 --- a/Scenes/Utilities.gd +++ b/Scenes/Utilities.gd @@ -106,6 +106,16 @@ func get_enemy_children(parent: Node): ) +func get_all_children(parent: Node): + var children = [] + + for child in parent.get_children(): + children.append(child) + children += get_all_children(child) + + return children + + func get_collision_shape_bounds(collision_shape: CollisionShape2D): var shape: Shape2D = collision_shape.shape var bounds @@ -188,4 +198,8 @@ class Condition: var function: Callable func check(): - return function.call() + var is_fulfilled = function.call() + if is_fulfilled: + fulfilled.emit() + + return is_fulfilled |