get a basic fade transition in
This commit is contained in:
parent
d3b4fc0e56
commit
50dbda5f27
|
@ -1,7 +1,17 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
signal on_scene_ready
|
signal on_scene_ready
|
||||||
|
signal on_scene_start
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
Game.game_started = true
|
|
||||||
emit_signal("on_scene_ready")
|
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")
|
|
@ -8,6 +8,7 @@ func _ready():
|
||||||
|
|
||||||
# start signal
|
# start signal
|
||||||
get_parent().connect("on_scene_ready", self, "_on_scene_ready")
|
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_init", self, "_on_dialog_init")
|
||||||
dialog_box.connect("on_dialog_completed", self, "_on_dialog_completed")
|
dialog_box.connect("on_dialog_completed", self, "_on_dialog_completed")
|
||||||
|
@ -21,6 +22,9 @@ func _on_scene_ready():
|
||||||
# init after yes
|
# init after yes
|
||||||
dialog_box.initialize_dialog()
|
dialog_box.initialize_dialog()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_scene_start():
|
||||||
|
|
||||||
# then entero
|
# then entero
|
||||||
dialog_box.enter_frame()
|
dialog_box.enter_frame()
|
||||||
|
|
||||||
|
|
4
game.gd
4
game.gd
|
@ -62,8 +62,10 @@ func _switch_scene_fnc(args):
|
||||||
if args.size() == 1:
|
if args.size() == 1:
|
||||||
var scene_name = args[0]
|
var scene_name = args[0]
|
||||||
transition.start_transition()
|
transition.start_transition()
|
||||||
yield(transition, "on_transition_completed")
|
yield(transition, "on_transition_time")
|
||||||
SceneSwitcher.goto_scene(Scenes[scene_name])
|
SceneSwitcher.goto_scene(Scenes[scene_name])
|
||||||
|
yield(transition, "on_transition_completed")
|
||||||
|
SceneSwitcher.current_scene.on_scene_start()
|
||||||
|
|
||||||
func _on_game_started_set(v):
|
func _on_game_started_set(v):
|
||||||
if v and not game_started:
|
if v and not game_started:
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[ext_resource path="res://game.gd" type="Script" id=1]
|
[ext_resource path="res://game.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://transition.gd" type="Script" id=2]
|
[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 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
[ext_resource path="res://dialog_layer.gd" type="Script" id=2]
|
[ext_resource path="res://dialog_layer.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://ui/dialog_box.tscn" type="PackedScene" id=3]
|
[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 )
|
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 )]
|
[node name="dialog_box" parent="dialog_layer" index="0" instance=ExtResource( 3 )]
|
||||||
|
|
||||||
|
_sections_unfolded = [ "Visibility" ]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ extends Control
|
||||||
onready var background = get_node("background")
|
onready var background = get_node("background")
|
||||||
onready var tween = get_node("tween")
|
onready var tween = get_node("tween")
|
||||||
|
|
||||||
|
signal on_transition_time()
|
||||||
signal on_transition_completed()
|
signal on_transition_completed()
|
||||||
|
|
||||||
const TRANSITION_TIME = 1.0
|
const TRANSITION_TIME = 1.0
|
||||||
|
@ -20,7 +21,7 @@ func start_transition():
|
||||||
|
|
||||||
tween.start()
|
tween.start()
|
||||||
yield(tween, "tween_completed")
|
yield(tween, "tween_completed")
|
||||||
emit_signal("on_transition_completed")
|
emit_signal("on_transition_time")
|
||||||
|
|
||||||
tween.interpolate_property(
|
tween.interpolate_property(
|
||||||
background, "color:a", background.color.a, 0.0,
|
background, "color:a", background.color.a, 0.0,
|
||||||
|
@ -28,4 +29,6 @@ func start_transition():
|
||||||
Tween.EASE_IN_OUT
|
Tween.EASE_IN_OUT
|
||||||
)
|
)
|
||||||
tween.start()
|
tween.start()
|
||||||
|
yield(tween, "tween_completed")
|
||||||
|
emit_signal("on_transition_completed")
|
||||||
|
|
|
@ -104,6 +104,10 @@ func set_dialog_anim_player(p):
|
||||||
func set_get_character_function(fnc):
|
func set_get_character_function(fnc):
|
||||||
get_node_fnc = fnc
|
get_node_fnc = fnc
|
||||||
|
|
||||||
|
# initially invisible
|
||||||
|
func _enter_tree():
|
||||||
|
modulate.a = 0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
|
|
||||||
advance_button.connect("pressed", self, "set_advance_state")
|
advance_button.connect("pressed", self, "set_advance_state")
|
||||||
|
|
Loading…
Reference in New Issue