Skip to content

Commit dc7fc64

Browse files
committed
Update: Scrolling Credits Menu
Changelog -> Added vertical scrolling and fadeout -> Reused assets to make a nice relaxing background.
1 parent ea10b40 commit dc7fc64

4 files changed

Lines changed: 196 additions & 15 deletions

File tree

Scenes/UI/Options/Credits.tscn

Lines changed: 138 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,61 @@
1-
[gd_scene load_steps=2 format=3 uid="uid://dgjmb0wllsj41"]
1+
[gd_scene load_steps=4 format=3 uid="uid://dgjmb0wllsj41"]
22

33
[ext_resource type="Script" uid="uid://drt21hext7pm2" path="res://Scenes/UI/Options/Scripts/CreditsMenu.cs" id="1_n36fd"]
4+
[ext_resource type="Texture2D" uid="uid://dbjotl0v1ymia" path="res://SharedAssets/BattleFrame1.png" id="2_72li1"]
5+
[ext_resource type="PackedScene" uid="uid://dfevfib11kou1" path="res://Scenes/ChartViewport/ChartViewport.tscn" id="3_ch0mg"]
46

5-
[node name="Control" type="Control" node_paths=PackedStringArray("_returnButton")]
7+
[node name="Control" type="Control" node_paths=PackedStringArray("CreditsText", "_returnButton")]
68
process_mode = 3
79
layout_mode = 3
810
anchors_preset = 0
911
offset_right = 40.0
1012
offset_bottom = 40.0
1113
script = ExtResource("1_n36fd")
12-
_returnButton = NodePath("CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer4/Return Button")
14+
CreditsText = NodePath("Node2D/Label")
15+
ScrollSpeed = 24.0
16+
FadeStartY = -120.0
17+
FadeEndY = -200.0
18+
RestartPositionY = 400.0
19+
_returnButton = NodePath("Return Button")
20+
21+
[node name="BattleFrame" type="TextureRect" parent="."]
22+
visible = false
23+
z_index = 2
24+
layout_mode = 0
25+
offset_left = -2.0
26+
offset_right = 1225.0
27+
offset_bottom = 349.0
28+
texture = ExtResource("2_72li1")
29+
30+
[node name="Node2D2" type="Node2D" parent="."]
31+
position = Vector2(80, -12.26)
32+
scale = Vector2(2.255, 2.01)
33+
34+
[node name="SubViewport" parent="Node2D2" instance=ExtResource("3_ch0mg")]
35+
offset_left = -57.1486
36+
offset_top = 5.0
37+
offset_right = 422.851
38+
offset_bottom = 185.0
1339

1440
[node name="ColorRect" type="ColorRect" parent="."]
41+
visible = false
1542
layout_mode = 0
16-
offset_right = 640.0
43+
offset_right = 664.8
1744
offset_bottom = 358.0
1845
color = Color(0.241156, 0.241156, 0.241156, 1)
1946

2047
[node name="CenterContainer" type="CenterContainer" parent="."]
48+
visible = false
2149
layout_mode = 0
2250
offset_right = 40.0
2351
offset_bottom = 40.0
2452

2553
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer"]
54+
visible = false
2655
layout_mode = 2
2756

2857
[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer"]
58+
visible = false
2959
layout_mode = 2
3060

3161
[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/MarginContainer/ColorRect"]
@@ -55,9 +85,9 @@ text = "Credits"
5585
[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"]
5686
layout_mode = 0
5787
offset_left = 2.32877
58-
offset_top = 11.6751
88+
offset_top = 11.0406
5989
offset_right = 219.329
60-
offset_bottom = 164.675
90+
offset_bottom = 164.041
6191
scale = Vector2(0.0566447, 0.0947541)
6292

6393
[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer"]
@@ -72,10 +102,10 @@ horizontal_alignment = 1
72102

73103
[node name="HBoxContainer2" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"]
74104
layout_mode = 0
75-
offset_left = 18.0137
76-
offset_top = 12.3096
77-
offset_right = 99.0137
78-
offset_bottom = 113.31
105+
offset_left = 17.6027
106+
offset_top = 11.2944
107+
offset_right = 98.6027
108+
offset_bottom = 112.295
79109
scale = Vector2(0.0602738, 0.102849)
80110

81111
[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer2"]
@@ -88,11 +118,11 @@ horizontal_alignment = 1
88118

89119
[node name="HBoxContainer3" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"]
90120
layout_mode = 0
91-
offset_left = 26.1644
92-
offset_top = 11.802
93-
offset_right = 200.164
94-
offset_bottom = 86.802
95-
scale = Vector2(0.0544615, 0.10085)
121+
offset_left = 26.2329
122+
offset_top = 10.533
123+
offset_right = 200.232
124+
offset_bottom = 85.533
125+
scale = Vector2(0.0572012, 0.105926)
96126

97127
[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer3"]
98128
layout_mode = 2
@@ -112,3 +142,96 @@ scale = Vector2(0.101568, 0.177799)
112142
layout_mode = 2
113143
text = "Return Button"
114144
flat = true
145+
146+
[node name="MarginContainer2" type="MarginContainer" parent="CenterContainer"]
147+
layout_mode = 2
148+
149+
[node name="VScrollBar" type="VScrollBar" parent="CenterContainer/MarginContainer2"]
150+
layout_mode = 2
151+
152+
[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/MarginContainer2/VScrollBar"]
153+
layout_mode = 2
154+
offset_left = 52.0
155+
offset_top = 13.0
156+
offset_right = 92.0
157+
offset_bottom = 53.0
158+
scale = Vector2(12.36, 7.2)
159+
text = "Credits
160+
161+
Programmers
162+
Jarod Spanger: Project Lead
163+
Connor Lowe
164+
Raul Mojarro
165+
Thomas Wessel
166+
Michael Quinn
167+
168+
Artists
169+
Ares Atlas
170+
Evelyn Fu
171+
Emily Wen
172+
173+
Sound
174+
Sam Meyer: Composer"
175+
176+
[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/MarginContainer2"]
177+
layout_mode = 2
178+
179+
[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer2"]
180+
layout_mode = 2
181+
182+
[node name="Node2D" type="Node2D" parent="."]
183+
184+
[node name="RichTextLabel" type="RichTextLabel" parent="Node2D"]
185+
visible = false
186+
offset_right = 637.0
187+
offset_bottom = 356.0
188+
text = "Credits
189+
190+
Programmers
191+
Jarod Spanger: Project Lead
192+
Connor Lowe
193+
Raul Mojarro
194+
Thomas Wessel
195+
Michael Quinn
196+
197+
Artists
198+
Ares Atlas
199+
Evelyn Fu
200+
Emily Wen
201+
202+
Sound
203+
Sam Meyer: Composer"
204+
horizontal_alignment = 1
205+
206+
[node name="Label" type="Label" parent="Node2D"]
207+
offset_left = 217.0
208+
offset_top = -3.0
209+
offset_right = 467.0
210+
offset_bottom = 410.0
211+
text = "Credits
212+
213+
Programmers
214+
Jarod Spanger: Project Lead
215+
Connor Lowe
216+
Raul Mojarro
217+
Thomas Wessel
218+
Michael Quinn
219+
220+
Artists
221+
Ares Atlas
222+
Evelyn Fu
223+
Emily Wen
224+
225+
Sound
226+
Sam Meyer: Composer"
227+
horizontal_alignment = 1
228+
229+
[node name="Return Button" type="Button" parent="."]
230+
layout_mode = 2
231+
offset_left = 570.0
232+
offset_top = 321.0
233+
offset_right = 631.0
234+
offset_bottom = 355.0
235+
text = "Return"
236+
flat = true
237+
icon_alignment = 1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://8u3fl0hlirqs

Scenes/UI/Options/Scripts/CreditsMenu.cs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,32 @@ public partial class CreditsMenu : Control, IFocusableMenu
55
{
66
public static readonly string LoadPath = "res://Scenes/UI/Options/Credits.tscn";
77

8+
[Export]
9+
public Label CreditsText;
10+
11+
[Export]
12+
public float ScrollSpeed = 50f;
13+
14+
[Export]
15+
public float FadeStartY = 200f;
16+
17+
[Export]
18+
public float FadeEndY = 50f;
19+
20+
[Export]
21+
public float RestartPositionY = 800f;
22+
823
[Export]
924
private Button _returnButton;
1025

1126
public IFocusableMenu Prev { get; set; }
1227

1328
public override void _Ready()
1429
{
30+
if (CreditsText != null)
31+
{
32+
CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY);
33+
}
1534
_returnButton.Pressed += ReturnToPrev;
1635
}
1736

@@ -47,4 +66,41 @@ public override void _Input(InputEvent @event)
4766
GetViewport().SetInputAsHandled();
4867
}
4968
}
69+
70+
public override void _Process(double delta)
71+
{
72+
if (CreditsText == null)
73+
return;
74+
75+
Vector2 position = CreditsText.Position;
76+
position.Y -= (float)(ScrollSpeed * delta);
77+
CreditsText.Position = position;
78+
79+
float alpha = 1.0f;
80+
if (CreditsText.GlobalPosition.Y < FadeStartY)
81+
{
82+
alpha = Mathf.Clamp(
83+
(CreditsText.GlobalPosition.Y - FadeEndY) / (FadeStartY - FadeEndY),
84+
0,
85+
1
86+
);
87+
}
88+
CreditsText.Modulate = new Color(1, 1, 1, alpha);
89+
90+
float bottomScreenY = RestartPositionY;
91+
float topScreenY = -780;
92+
float t = Mathf.Clamp(
93+
(CreditsText.GlobalPosition.Y - topScreenY) / (bottomScreenY - topScreenY),
94+
0,
95+
1
96+
);
97+
98+
float scaleValue = Mathf.Lerp(0.05f, 1.0f, t);
99+
CreditsText.Scale = new Vector2(scaleValue, scaleValue);
100+
101+
if (CreditsText.GlobalPosition.Y + CreditsText.Size.Y * CreditsText.Scale.Y < 0)
102+
{
103+
CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY);
104+
}
105+
}
50106
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://del0uuo6fwtfn

0 commit comments

Comments
 (0)