Skip to content

Commit 70cce08

Browse files
committed
Fix Incorrect Game Selection
Fix incorrect game being selected occasionally when returning from a game. Occurs because the game selection animations' path changes persist on reloading a scene.
1 parent f8fdb8a commit 70cce08

5 files changed

Lines changed: 104 additions & 25 deletions

File tree

HellHole/HellHole.tscn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[gd_scene format=3 uid="uid://do3jinnfccsjs"]
2+
3+
[node name="HellHole" type="Node2D"]

TitleScreen/GameTurnTable.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public override void _Ready()
3131
sprite.Play();
3232
}
3333

34+
ResetAnimPaths();
3435
_animationPlayer.AnimationFinished += OnAnimFinished;
3536
}
3637

@@ -88,4 +89,15 @@ public void OnAnimFinished(StringName animName)
8889
_sliding = false;
8990
GD.Print("Current Selection is " + _animatedNames[_currentSelection]);
9091
}
92+
93+
private void ResetAnimPaths() //I feel like animation path changes shouldn't persist on reloading a scene. Workaround for now.
94+
{
95+
for (int i = 0; i < _animationPlayer.GetAnimation("Master").GetTrackCount(); i++)
96+
{
97+
NodePath path = _animationPlayer.GetAnimation("Master").TrackGetPath(i);
98+
_animationPlayer.GetAnimation("GameSlidesRev").TrackSetPath(i, path);
99+
_animationPlayer.GetAnimation("GameSlidesFor").TrackSetPath(i, path);
100+
}
101+
}
102+
91103
}

TitleScreen/TitleScreen.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public override void _Ready()
3131

3232
public override void _Input(InputEvent @event)
3333
{
34+
_timer.Start();
35+
3436
if (@event.IsActionPressed("ButtonA") && !_isScreensaverActive)
3537
{
3638
GetTree().ChangeSceneToFile( _buttonSceneMap[_gameTurnTable.GetCurrentSelection()]);
@@ -41,6 +43,10 @@ public override void _Input(InputEvent @event)
4143
return; // These are the only events that should reset the screensaver. Doing this bc I think the touch screen is causing issues
4244
}
4345

46+
if (@event.IsActionPressed("Mute")) //Non-reversible, mainly to not go insane while testing.
47+
{
48+
AudioServer.SetBusMute(AudioServer.GetBusIndex("Master"), true);
49+
}
4450

4551
if (_isScreensaverActive)
4652
{
@@ -49,7 +55,6 @@ public override void _Input(InputEvent @event)
4955
_screensaverNode.Visible = false;
5056
}
5157

52-
_timer.Start();
5358
}
5459

5560
private void _startScreensaver()

TitleScreen/TitleScreen.tscn

Lines changed: 78 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=17 format=3 uid="uid://nd7ukwmx7jhi"]
1+
[gd_scene load_steps=18 format=3 uid="uid://nd7ukwmx7jhi"]
22

33
[ext_resource type="Script" uid="uid://b1wukt21q1qto" path="res://TitleScreen/TitleScreen.cs" id="1_uidrc"]
44
[ext_resource type="Shader" uid="uid://c24kwaabn8wdb" path="res://TitleScreen/TitleScreen.gdshader" id="2_g0pfn"]
@@ -19,7 +19,58 @@ shader_parameter/scanline_intensity = 0.5
1919
shader_parameter/chromatic_aberration_strength = 0.005
2020
shader_parameter/chromatic_aberration_direction = Vector2(1, 0)
2121

22-
[sub_resource type="Animation" id="Animation_4x3tk"]
22+
[sub_resource type="Animation" id="Animation_70hon"]
23+
length = 0.001
24+
tracks/0/type = "value"
25+
tracks/0/imported = false
26+
tracks/0/enabled = true
27+
tracks/0/path = NodePath("CurrentGame:position")
28+
tracks/0/interp = 1
29+
tracks/0/loop_wrap = true
30+
tracks/0/keys = {
31+
"times": PackedFloat32Array(0),
32+
"transitions": PackedFloat32Array(1),
33+
"update": 0,
34+
"values": [Vector2(640, 480)]
35+
}
36+
tracks/1/type = "value"
37+
tracks/1/imported = false
38+
tracks/1/enabled = true
39+
tracks/1/path = NodePath("PrevGame:position")
40+
tracks/1/interp = 1
41+
tracks/1/loop_wrap = true
42+
tracks/1/keys = {
43+
"times": PackedFloat32Array(0),
44+
"transitions": PackedFloat32Array(1),
45+
"update": 0,
46+
"values": [Vector2(-130, 480)]
47+
}
48+
tracks/2/type = "value"
49+
tracks/2/imported = false
50+
tracks/2/enabled = true
51+
tracks/2/path = NodePath("NextGame:position")
52+
tracks/2/interp = 1
53+
tracks/2/loop_wrap = true
54+
tracks/2/keys = {
55+
"times": PackedFloat32Array(0),
56+
"transitions": PackedFloat32Array(1),
57+
"update": 0,
58+
"values": [Vector2(1410, 480)]
59+
}
60+
tracks/3/type = "value"
61+
tracks/3/imported = false
62+
tracks/3/enabled = true
63+
tracks/3/path = NodePath("SlideIn:position")
64+
tracks/3/interp = 1
65+
tracks/3/loop_wrap = true
66+
tracks/3/keys = {
67+
"times": PackedFloat32Array(0),
68+
"transitions": PackedFloat32Array(1),
69+
"update": 0,
70+
"values": [Vector2(2180, 480)]
71+
}
72+
73+
[sub_resource type="Animation" id="Animation_mhd54"]
2374
resource_name = "GameSlides"
2475
length = 0.5
2576
step = 0.5
@@ -72,7 +123,7 @@ tracks/3/keys = {
72123
"values": [Vector2(-130, 480), Vector2(-900, 480)]
73124
}
74125

75-
[sub_resource type="Animation" id="Animation_j3fyg"]
126+
[sub_resource type="Animation" id="Animation_j8ysg"]
76127
resource_name = "GameSlidesRev"
77128
length = 0.5
78129
step = 0.5
@@ -125,61 +176,64 @@ tracks/3/keys = {
125176
"values": [Vector2(-130, 480), Vector2(640, 480)]
126177
}
127178

128-
[sub_resource type="Animation" id="Animation_70hon"]
129-
length = 0.001
179+
[sub_resource type="Animation" id="Animation_eufha"]
180+
resource_name = "GameSlides"
181+
length = 0.5
182+
step = 0.5
130183
tracks/0/type = "value"
131184
tracks/0/imported = false
132185
tracks/0/enabled = true
133186
tracks/0/path = NodePath("CurrentGame:position")
134187
tracks/0/interp = 1
135188
tracks/0/loop_wrap = true
136189
tracks/0/keys = {
137-
"times": PackedFloat32Array(0),
138-
"transitions": PackedFloat32Array(1),
190+
"times": PackedFloat32Array(0, 0.5),
191+
"transitions": PackedFloat32Array(1, 1),
139192
"update": 0,
140-
"values": [Vector2(640, 480)]
193+
"values": [Vector2(640, 480), Vector2(-130, 480)]
141194
}
142195
tracks/1/type = "value"
143196
tracks/1/imported = false
144197
tracks/1/enabled = true
145-
tracks/1/path = NodePath("PrevGame:position")
198+
tracks/1/path = NodePath("NextGame:position")
146199
tracks/1/interp = 1
147200
tracks/1/loop_wrap = true
148201
tracks/1/keys = {
149-
"times": PackedFloat32Array(0),
150-
"transitions": PackedFloat32Array(1),
202+
"times": PackedFloat32Array(0, 0.5),
203+
"transitions": PackedFloat32Array(1, 1),
151204
"update": 0,
152-
"values": [Vector2(-130, 480)]
205+
"values": [Vector2(1410, 480), Vector2(640, 480)]
153206
}
154207
tracks/2/type = "value"
155208
tracks/2/imported = false
156209
tracks/2/enabled = true
157-
tracks/2/path = NodePath("NextGame:position")
210+
tracks/2/path = NodePath("SlideIn:position")
158211
tracks/2/interp = 1
159212
tracks/2/loop_wrap = true
160213
tracks/2/keys = {
161-
"times": PackedFloat32Array(0),
162-
"transitions": PackedFloat32Array(1),
214+
"times": PackedFloat32Array(0, 0.5),
215+
"transitions": PackedFloat32Array(1, 1),
163216
"update": 0,
164-
"values": [Vector2(1410, 480)]
217+
"values": [Vector2(2180, 480), Vector2(1410, 480)]
165218
}
166219
tracks/3/type = "value"
167220
tracks/3/imported = false
168221
tracks/3/enabled = true
169-
tracks/3/path = NodePath("SlideIn:position")
222+
tracks/3/path = NodePath("PrevGame:position")
170223
tracks/3/interp = 1
171224
tracks/3/loop_wrap = true
172225
tracks/3/keys = {
173-
"times": PackedFloat32Array(0),
174-
"transitions": PackedFloat32Array(1),
226+
"times": PackedFloat32Array(0, 0.5),
227+
"transitions": PackedFloat32Array(1, 1),
175228
"update": 0,
176-
"values": [Vector2(2180, 480)]
229+
"values": [Vector2(-130, 480), Vector2(-900, 480)]
177230
}
178231

179-
[sub_resource type="AnimationLibrary" id="AnimationLibrary_70hon"]
232+
[sub_resource type="AnimationLibrary" id="AnimationLibrary_eufha"]
180233
_data = {
181-
&"GameSlidesFor": SubResource("Animation_4x3tk"),
182-
&"GameSlidesRev": SubResource("Animation_j3fyg"),
234+
&"GameSlidesFor": SubResource("Animation_mhd54"),
235+
&"GameSlidesRev": SubResource("Animation_j8ysg"),
236+
&"Master": SubResource("Animation_eufha"),
183237
&"RESET": SubResource("Animation_70hon")
184238
}
185239

@@ -336,7 +390,7 @@ frame_progress = 0.567812
336390

337391
[node name="AnimationPlayer" type="AnimationPlayer" parent="GameTurnTable"]
338392
libraries = {
339-
&"": SubResource("AnimationLibrary_70hon")
393+
&"": SubResource("AnimationLibrary_eufha")
340394
}
341395

342396
[node name="Timer" type="Timer" parent="."]

project.godot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ prank={
9595
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":80,"key_label":0,"unicode":112,"location":0,"echo":false,"script":null)
9696
]
9797
}
98+
Mute={
99+
"deadzone": 0.2,
100+
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null)
101+
]
102+
}
98103

99104
[rendering]
100105

0 commit comments

Comments
 (0)