From 3dcccf2001ac2914516f6e4e3180046380857eeb Mon Sep 17 00:00:00 2001 From: Ategon Date: Sat, 14 Sep 2024 22:50:11 -0400 Subject: [PATCH] Add title screen --- Main.tscn | 187 +++++++++++++++++++++++++++++++++++++++++++++++++- small_wave.gd | 29 ++++++++ start.gd | 5 ++ ui.gd | 9 +++ 4 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 small_wave.gd create mode 100644 start.gd create mode 100644 ui.gd diff --git a/Main.tscn b/Main.tscn index 72daa4a..6cab439 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=4 uid="uid://5ske2hm55rce"] +[gd_scene load_steps=26 format=4 uid="uid://5ske2hm55rce"] [ext_resource type="PackedScene" uid="uid://n2lpy72tkyc8" path="res://storm/StormManager.tscn" id="1_gcxt1"] [ext_resource type="Script" path="res://main.gd" id="1_pg2kh"] @@ -13,10 +13,124 @@ [ext_resource type="PackedScene" uid="uid://byyyhq3x8t2d8" path="res://InfoWindow.tscn" id="7_f4xfy"] [ext_resource type="PackedScene" uid="uid://b22pr3istdhcv" path="res://ui/BuildingMenu.tscn" id="7_hnxcf"] [ext_resource type="Script" path="res://ui_level.gd" id="9_8qp2o"] +[ext_resource type="Script" path="res://ui.gd" id="10_vm6py"] [ext_resource type="PackedScene" path="res://Night.tscn" id="13_8fvl0"] [ext_resource type="AudioStream" uid="uid://dfxndvkdey800" path="res://light version final(1).wav" id="13_tvksj"] +[ext_resource type="Script" path="res://start.gd" id="14_3fkxs"] +[ext_resource type="Script" path="res://small_wave.gd" id="14_d8e1g"] [ext_resource type="AudioStream" uid="uid://dk2thkxy31doi" path="res://heavy version.wav" id="14_frsfx"] +[sub_resource type="Animation" id="Animation_ycb31"] +resource_name = "start" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CanvasLayer/Start/RichTextLabel:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.366667), +"transitions": PackedFloat32Array(1, 0.5), +"update": 0, +"values": [Vector2(1, 1), Vector2(0, 0)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("CanvasLayer/Start/RichTextLabel2:scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0.266667, 0.633333), +"transitions": PackedFloat32Array(1, 0.5), +"update": 0, +"values": [Vector2(1, 1), Vector2(0, 0)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("CanvasLayer/Start:modulate") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0.133333, 0.9), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("CanvasLayer/StartOverlay:modulate") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0.133333, 0.833333), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} + +[sub_resource type="Animation" id="Animation_gcod0"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CanvasLayer/Start/RichTextLabel:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("CanvasLayer/Start/RichTextLabel2:scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(1, 1)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("CanvasLayer/Start:modulate") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("CanvasLayer/StartOverlay:modulate") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 1)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_8mn2x"] +_data = { +"RESET": SubResource("Animation_gcod0"), +"start": SubResource("Animation_ycb31") +} + +[sub_resource type="RichTextEffect" id="RichTextEffect_1jsuj"] +script = ExtResource("14_d8e1g") + [sub_resource type="AudioStreamInteractive" id="AudioStreamInteractive_ajguf"] clip_count = 2 clip_0/name = &"Light Version Final(1)" @@ -206,22 +320,93 @@ tile_set = ExtResource("2_68wnv") script = ExtResource("9_8qp2o") [node name="CanvasLayer" type="CanvasLayer" parent="."] +script = ExtResource("10_vm6py") + +[node name="AnimationPlayer" type="AnimationPlayer" parent="CanvasLayer"] +root_node = NodePath("../..") +libraries = { +"": SubResource("AnimationLibrary_8mn2x") +} [node name="UI" parent="CanvasLayer" instance=ExtResource("1_ve2mn")] +visible = false anchors_preset = 15 anchor_bottom = 1.0 offset_bottom = 0.0 grow_vertical = 2 [node name="InfoWindow" parent="CanvasLayer" instance=ExtResource("7_f4xfy")] +visible = false pivot_offset = Vector2(114, 128) [node name="BuildingMenu" parent="CanvasLayer" instance=ExtResource("7_hnxcf")] +visible = false [node name="Night" parent="CanvasLayer" instance=ExtResource("13_8fvl0")] modulate = Color(1, 1, 1, 0) color = Color(0.121569, 0, 0.25098, 0.392157) +[node name="StartOverlay" type="ColorRect" parent="CanvasLayer"] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0.556863) + +[node name="Start" type="Control" parent="CanvasLayer"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme = ExtResource("1_xbn5h") +script = ExtResource("14_3fkxs") + +[node name="RichTextLabel" type="RichTextLabel" parent="CanvasLayer/Start"] +self_modulate = Color(0.207843, 0.572549, 0.341176, 1) +clip_contents = false +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -146.0 +offset_top = -31.0 +offset_right = 146.0 +offset_bottom = 51.0 +grow_horizontal = 2 +grow_vertical = 2 +pivot_offset = Vector2(145, 9) +theme_override_constants/outline_size = 6 +theme_override_font_sizes/normal_font_size = 16 +bbcode_enabled = true +text = "[center]Floodworks" + +[node name="RichTextLabel2" type="RichTextLabel" parent="CanvasLayer/Start"] +self_modulate = Color(0.724643, 0.724643, 0.724642, 1) +clip_contents = false +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -146.0 +offset_top = -1.0 +offset_right = 146.0 +offset_bottom = 81.0 +grow_horizontal = 2 +grow_vertical = 2 +pivot_offset = Vector2(143, 4) +theme_override_constants/outline_size = 3 +theme_override_font_sizes/normal_font_size = 8 +bbcode_enabled = true +text = "[center][smallwave]Press Left Click" +custom_effects = [SubResource("RichTextEffect_1jsuj")] + [node name="CanvasLayer2" type="CanvasLayer" parent="."] layer = -1 diff --git a/small_wave.gd b/small_wave.gd new file mode 100644 index 0000000..a03b0b9 --- /dev/null +++ b/small_wave.gd @@ -0,0 +1,29 @@ +@tool +extends RichTextEffect +class_name SmallWaveEffect + +var bbcode = "smallwave" + +func _process_custom_fx(char_fx: CharFXTransform) -> bool: + var time = fmod(char_fx.elapsed_time * 8 - char_fx.relative_index + 100, 10) + var local_time = fmod(time, 1) + + if time < 1: + char_fx.offset = Vector2(0, -5 * (sin(local_time * PI))) + if time < 3 or time >= 8: + var color_time = local_time + if time >= 1 and time < 3: + color_time += 1 + if time >= 2 and time < 3: + color_time += 1 + if time >= 0 and time < 3: + color_time += 1 + if time >= 9 or time < 3: + color_time += 1 + + + char_fx.color.a = (sin(color_time / 5 * PI)) * 0.3 + 0.7 + else: + char_fx.color.a = 0.7 + + return true diff --git a/start.gd b/start.gd new file mode 100644 index 0000000..9216b05 --- /dev/null +++ b/start.gd @@ -0,0 +1,5 @@ +extends Control + + +func _process(delta: float) -> void: + position = (Vector2(320, 180) - get_global_mouse_position()) / 80 diff --git a/ui.gd b/ui.gd new file mode 100644 index 0000000..104fc64 --- /dev/null +++ b/ui.gd @@ -0,0 +1,9 @@ +extends CanvasLayer + +@onready var animation_player: AnimationPlayer = $AnimationPlayer + + +func _process(delta: float) -> void: + if Input.is_action_just_pressed("lclick") and not Persister.get_value("game_started"): + Persister.persist_data("game_started", true) + animation_player.play("start")