diff --git a/common/scene.gd b/common/scene.gd index 989a62d..aa38c47 100644 --- a/common/scene.gd +++ b/common/scene.gd @@ -1,7 +1,17 @@ extends Node2D signal on_scene_ready +signal on_scene_start func _ready(): - Game.game_started = true - emit_signal("on_scene_ready") \ No newline at end of file + + if not Game.game_started: + Game.game_started = true + emit_signal("on_scene_ready") + on_scene_start() + else: + emit_signal("on_scene_ready") + + +func on_scene_start(): + emit_signal("on_scene_start") \ No newline at end of file diff --git a/dialog_layer.gd b/dialog_layer.gd index 9fc9d02..4050aea 100644 --- a/dialog_layer.gd +++ b/dialog_layer.gd @@ -8,6 +8,7 @@ func _ready(): # start signal get_parent().connect("on_scene_ready", self, "_on_scene_ready") + get_parent().connect("on_scene_start", self, "_on_scene_start") dialog_box.connect("on_dialog_init", self, "_on_dialog_init") dialog_box.connect("on_dialog_completed", self, "_on_dialog_completed") @@ -21,6 +22,9 @@ func _on_scene_ready(): # init after yes dialog_box.initialize_dialog() + +func _on_scene_start(): + # then entero dialog_box.enter_frame() diff --git a/game.gd b/game.gd index 373290c..5682a0f 100644 --- a/game.gd +++ b/game.gd @@ -62,8 +62,10 @@ func _switch_scene_fnc(args): if args.size() == 1: var scene_name = args[0] transition.start_transition() - yield(transition, "on_transition_completed") + yield(transition, "on_transition_time") SceneSwitcher.goto_scene(Scenes[scene_name]) + yield(transition, "on_transition_completed") + SceneSwitcher.current_scene.on_scene_start() func _on_game_started_set(v): if v and not game_started: diff --git a/game.tscn b/game.tscn index 4db49ad..6cd1b8c 100644 --- a/game.tscn +++ b/game.tscn @@ -3,7 +3,7 @@ [ext_resource path="res://game.gd" type="Script" id=1] [ext_resource path="res://transition.gd" type="Script" id=2] -[node name="Game" type="Node" index="0"] +[node name="Game" type="Node"] script = ExtResource( 1 ) diff --git a/scenes/intro.tscn b/scenes/intro.tscn index eb08ac7..d290c38 100644 --- a/scenes/intro.tscn +++ b/scenes/intro.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://dialog_layer.gd" type="Script" id=2] [ext_resource path="res://ui/dialog_box.tscn" type="PackedScene" id=3] -[node name="intro" type="Node2D"] +[node name="intro" type="Node2D" index="0"] script = ExtResource( 1 ) @@ -22,4 +22,6 @@ dialog_path = "res://dialog/introduction.txt" [node name="dialog_box" parent="dialog_layer" index="0" instance=ExtResource( 3 )] +_sections_unfolded = [ "Visibility" ] + diff --git a/transition.gd b/transition.gd index dd39985..64662c9 100644 --- a/transition.gd +++ b/transition.gd @@ -3,6 +3,7 @@ extends Control onready var background = get_node("background") onready var tween = get_node("tween") +signal on_transition_time() signal on_transition_completed() const TRANSITION_TIME = 1.0 @@ -20,7 +21,7 @@ func start_transition(): tween.start() yield(tween, "tween_completed") - emit_signal("on_transition_completed") + emit_signal("on_transition_time") tween.interpolate_property( background, "color:a", background.color.a, 0.0, @@ -28,4 +29,6 @@ func start_transition(): Tween.EASE_IN_OUT ) tween.start() + yield(tween, "tween_completed") + emit_signal("on_transition_completed") \ No newline at end of file diff --git a/ui/dialog_box.gd b/ui/dialog_box.gd index 435fdc0..13107f1 100644 --- a/ui/dialog_box.gd +++ b/ui/dialog_box.gd @@ -104,6 +104,10 @@ func set_dialog_anim_player(p): func set_get_character_function(fnc): get_node_fnc = fnc +# initially invisible +func _enter_tree(): + modulate.a = 0 + func _ready(): advance_button.connect("pressed", self, "set_advance_state")