summaryrefslogtreecommitdiff
path: root/Scenes/Utilities.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-04-22 16:34:25 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-04-22 16:34:25 +0200
commitc8a316e4b8987dad963656a34665fa0e23dedcb1 (patch)
tree569af4b4f37d21079b6aedfad5164e94b50b6cb8 /Scenes/Utilities.gd
parentf27937e6e9b6a7146dd09fc711d2d293ecf5abbf (diff)
update
Diffstat (limited to 'Scenes/Utilities.gd')
-rw-r--r--Scenes/Utilities.gd14
1 files changed, 14 insertions, 0 deletions
diff --git a/Scenes/Utilities.gd b/Scenes/Utilities.gd
index 8dbe666..bcdfe7e 100644
--- a/Scenes/Utilities.gd
+++ b/Scenes/Utilities.gd
@@ -4,6 +4,8 @@ extends Node
const TILE_SIZE = 16
const SCREEN_FADE_DURATION = 0.25
+static var has_dialog = false
+
func get_level_position(scene) -> Vector2:
return self.from_position_to_grid(scene.position)
@@ -86,6 +88,18 @@ func fade_bg_music(duration: float = SCREEN_FADE_DURATION):
)
+func dialog(timeline: Variant):
+ if not self.has_dialog:
+ self.has_dialog = true
+ get_tree().paused = true
+ Dialogic.start(timeline).process_mode = Node.PROCESS_MODE_ALWAYS
+ Dialogic.process_mode = PROCESS_MODE_ALWAYS
+ await Dialogic.timeline_ended
+ get_tree().paused = false
+ await get_tree().create_timer(0.5).timeout
+ self.has_dialog = false
+
+
func get_collision_shape_bounds(collision_shape: CollisionShape2D):
var shape: Shape2D = collision_shape.shape
var bounds