diff options
author | Henrique Alves <henriquelalves@gmail.com> | 2024-01-25 02:04:28 +0200 |
---|---|---|
committer | Henrique Alves <henriquelalves@gmail.com> | 2024-01-25 02:04:28 +0200 |
commit | 22da7c525f561f612054b6774f2706747eaa3c9a (patch) | |
tree | 9efb99f3730abba2888a56eaed920c01806e8d4f /game/transition | |
parent | a4ed38306d49a4654570d48d6a7fe5c810ec5da8 (diff) | |
download | gamejam-ggj-2024-22da7c525f561f612054b6774f2706747eaa3c9a.tar.gz gamejam-ggj-2024-22da7c525f561f612054b6774f2706747eaa3c9a.tar.bz2 gamejam-ggj-2024-22da7c525f561f612054b6774f2706747eaa3c9a.zip |
testing transition flow
Diffstat (limited to 'game/transition')
-rw-r--r-- | game/transition/transition.gd | 24 | ||||
-rw-r--r-- | game/transition/transition.tscn | 203 |
2 files changed, 227 insertions, 0 deletions
diff --git a/game/transition/transition.gd b/game/transition/transition.gd new file mode 100644 index 0000000..45daf65 --- /dev/null +++ b/game/transition/transition.gd @@ -0,0 +1,24 @@ +class_name Transition +extends Node2D + +@export var speed_scale = 1.0 + +@onready var animation_player = %AnimationPlayer +@onready var microgame_viewport_container = %MicrogameViewportContainer + +signal finished +signal microgame_viewport_hidden + + +func _ready() -> void: + animation_player.speed_scale = speed_scale + + +func _emit_microgame_viewport_hidden() -> void: + microgame_viewport_hidden.emit() + + +func show_win_animation(): + animation_player.play("win_transition") + await animation_player.animation_finished + finished.emit() diff --git a/game/transition/transition.tscn b/game/transition/transition.tscn new file mode 100644 index 0000000..0fdeb01 --- /dev/null +++ b/game/transition/transition.tscn @@ -0,0 +1,203 @@ +[gd_scene load_steps=6 format=3 uid="uid://u3g8s4kck61t"] + +[ext_resource type="Script" path="res://game/transition/transition.gd" id="1_vtfth"] + +[sub_resource type="LabelSettings" id="LabelSettings_wobn0"] +font_size = 44 +font_color = Color(0, 0, 0, 1) + +[sub_resource type="Animation" id="Animation_lm0of"] +resource_name = "win_transition" +length = 5.0 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Foreground/Label:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 1.5, 3.5, 5), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(511, -116), Vector2(521, 289), Vector2(521, 289), Vector2(-282, 283)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Foreground/ViewportContainer/ColorRect:color") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.5, 4, 5), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Foreground/ViewportContainer:size") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 0.5, 4, 5), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(1152, 648), Vector2(432, 220), Vector2(432, 220), Vector2(1152, 648)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Foreground/ViewportContainer:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0, 0.5, 4, 5), +"transitions": PackedFloat32Array(1, 1, 1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(360, 68), Vector2(360, 68), Vector2(0, 0)] +} +tracks/4/type = "method" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath(".") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0.6), +"transitions": PackedFloat32Array(1), +"values": [{ +"args": [], +"method": &"_emit_microgame_viewport_hidden" +}] +} + +[sub_resource type="Animation" id="Animation_hump4"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Foreground/Label:position") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(511, -116)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Foreground/ViewportContainer/ColorRect:color") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 0)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Foreground/ViewportContainer:size") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1152, 648)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Foreground/ViewportContainer:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_en0c8"] +_data = { +"RESET": SubResource("Animation_hump4"), +"win_transition": SubResource("Animation_lm0of") +} + +[node name="Transition" type="Node2D"] +script = ExtResource("1_vtfth") + +[node name="Background" type="CanvasLayer" parent="."] + +[node name="BackgroundRect" type="Control" parent="Background"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ColorRect" type="ColorRect" parent="Background/BackgroundRect"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.976471, 0.780392, 0.717647, 1) + +[node name="Foreground" type="CanvasLayer" parent="."] + +[node name="ViewportContainer" type="Control" parent="Foreground"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_right = 1152.0 +offset_bottom = 648.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="MicrogameViewportContainer" type="Control" parent="Foreground/ViewportContainer"] +unique_name_in_owner = true +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="ColorRect" type="ColorRect" parent="Foreground/ViewportContainer"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(1, 1, 1, 0) + +[node name="Label" type="Label" parent="Foreground"] +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = 511.0 +offset_top = -116.0 +offset_right = 641.0 +offset_bottom = -55.0 +grow_horizontal = 2 +grow_vertical = 2 +text = "blabla" +label_settings = SubResource("LabelSettings_wobn0") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +"": SubResource("AnimationLibrary_en0c8") +} |