summaryrefslogtreecommitdiff
path: root/Scenes/Utilities.gd
diff options
context:
space:
mode:
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