Add exit feedback and restyle pressed button state

This commit is contained in:
Henry 2025-10-12 15:46:06 +01:00
parent 49988ae674
commit e3f2be7e4d
3 changed files with 39 additions and 25 deletions

View file

@ -61,17 +61,14 @@ expand_margin_top = 52.0
expand_margin_right = 52.0
expand_margin_bottom = 52.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5f4su"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(0.3529412, 0.23137255, 0.3372549, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 3
corner_detail = 5
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cek52"]
content_margin_left = 136.0
content_margin_right = 136.0
bg_color = Color(0.12536299, 0.1473065, 0.18297023, 1)
expand_margin_left = 52.0
expand_margin_top = 52.0
expand_margin_right = 52.0
expand_margin_bottom = 52.0
[resource]
Button/colors/font_color = Color(0.875, 0.875, 0.875, 1)
@ -98,4 +95,4 @@ Button/styles/disabled = SubResource("StyleBoxFlat_svo66")
Button/styles/focus = SubResource("StyleBoxFlat_u7j1g")
Button/styles/hover = SubResource("StyleBoxFlat_gwd0w")
Button/styles/normal = SubResource("StyleBoxFlat_gq8b7")
Button/styles/pressed = SubResource("StyleBoxFlat_5f4su")
Button/styles/pressed = SubResource("StyleBoxFlat_cek52")

View file

@ -61,12 +61,12 @@ polygon = PackedVector2Array(-30, -10, -30, 10, 1172, 10, 1172, -10)
[node name="Paddle-0" parent="." node_paths=PackedStringArray("score_label") instance=ExtResource("1_80nbo")]
position = Vector2(40, 273)
score_label = NodePath("../HBoxContainer/Score-0")
score_label = NodePath("../VBoxContainer/HBoxContainer/Score-0")
[node name="Paddle-1" parent="." node_paths=PackedStringArray("score_label") instance=ExtResource("1_80nbo")]
position = Vector2(1078, 273)
player_id = 1
score_label = NodePath("../HBoxContainer/Score-1")
score_label = NodePath("../VBoxContainer/HBoxContainer/Score-1")
[node name="Ball" type="CharacterBody2D" parent="." node_paths=PackedStringArray("paddle_0", "paddle_1")]
position = Vector2(134, 72)
@ -85,22 +85,37 @@ shape = SubResource("RectangleShape2D_feb5d")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="Ball"]
position = Vector2(110, 85)
[node name="HBoxContainer" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 10
anchor_right = 1.0
offset_top = 20.0
offset_bottom = 75.0
grow_horizontal = 2
[node name="message_exit" type="RichTextLabel" parent="."]
layout_mode = 0
offset_left = 28.0
offset_top = 25.0
offset_right = 1152.0
offset_bottom = 48.0
fit_content = true
scroll_active = false
autowrap_trim_flags = 0
vertical_alignment = 2
[node name="Score-0" type="Label" parent="HBoxContainer"]
[node name="VBoxContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = -1
anchor_right = 1.0
offset_top = 25.0
offset_bottom = 107.0
grow_horizontal = 2
theme_override_constants/separation = -10
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
[node name="Score-0" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 40
text = "00"
horizontal_alignment = 1
[node name="Score-1" type="Label" parent="HBoxContainer"]
[node name="Score-1" type="Label" parent="VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 40

View file

@ -4,5 +4,7 @@ func _ready():
set_process(true)
func _process(_delta):
if Input.is_action_pressed("key_exit"):
get_tree().change_scene_to_file("res://scenes/Start.tscn")
if Input.is_action_pressed("key_exit"):
$message_exit.text = "Exiting to main menu…"
await get_tree().create_timer(2).timeout
get_tree().change_scene_to_file("res://scenes/Start.tscn")