Skip to content

Commit

Permalink
Merge pull request #24 from Nogal/scene_transition
Browse files Browse the repository at this point in the history
updated scene transition
  • Loading branch information
Nogal committed Nov 11, 2023
2 parents 9ae7069 + b283d3c commit 938233f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/Game/scene_manager.gd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends Node2D
extends CanvasLayer


# Called when the node enters the scene tree for the first time.
Expand All @@ -11,4 +11,7 @@ func _process(delta):
pass

func change_scene(scene_path):
get_node("AnimationPlayer").play('dissolve')
await get_node("AnimationPlayer").animation_finished
get_tree().change_scene_to_file(scene_path)
get_node("AnimationPlayer").play_backwards('dissolve')
57 changes: 55 additions & 2 deletions src/Game/scene_manager.tscn
Original file line number Diff line number Diff line change
@@ -1,6 +1,59 @@
[gd_scene load_steps=2 format=3 uid="uid://loprsm6b0v2e"]
[gd_scene load_steps=5 format=3 uid="uid://loprsm6b0v2e"]

[ext_resource type="Script" path="res://src/Game/scene_manager.gd" id="1_ytxqv"]

[node name="SceneManager" type="Node2D"]
[sub_resource type="Animation" id="Animation_si8ck"]
resource_name = "RESET"
length = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("dissolve_layer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}

[sub_resource type="Animation" id="Animation_ssnv7"]
resource_name = "dissolve"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("dissolve_layer:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_fvwhk"]
_data = {
"RESET": SubResource("Animation_si8ck"),
"dissolve": SubResource("Animation_ssnv7")
}

[node name="SceneManager" type="CanvasLayer"]
script = ExtResource("1_ytxqv")

[node name="dissolve_layer" type="ColorRect" parent="."]
modulate = Color(1, 1, 1, 0)
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
color = Color(0.541176, 0.996078, 0.847059, 1)

[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_fvwhk")
}

0 comments on commit 938233f

Please sign in to comment.