summaryrefslogtreecommitdiff
path: root/Scenes/Utilities.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-05-23 14:11:43 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-05-23 14:11:43 +0200
commit06647b11ee163bc40daf454d87e1fcae563c3ced (patch)
tree866823ed79fa1c3bbdcb8b0be417f028f0c92d9b /Scenes/Utilities.gd
parent276b7664bd4a475a3ca93a682c16b49c504c58f7 (diff)
update
Diffstat (limited to 'Scenes/Utilities.gd')
-rw-r--r--Scenes/Utilities.gd16
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