diff --git a/scripts/Paddle.gd b/Paddle.gd similarity index 100% rename from scripts/Paddle.gd rename to Paddle.gd diff --git a/scripts/Paddle.gd.uid b/Paddle.gd.uid similarity index 100% rename from scripts/Paddle.gd.uid rename to Paddle.gd.uid diff --git a/scripts/ball.gd b/ball.gd similarity index 100% rename from scripts/ball.gd rename to ball.gd diff --git a/scripts/ball.gd.uid b/ball.gd.uid similarity index 100% rename from scripts/ball.gd.uid rename to ball.gd.uid diff --git a/scenes/gameplay.tscn b/game.tscn similarity index 74% rename from scenes/gameplay.tscn rename to game.tscn index 4422d88..3c52721 100644 --- a/scenes/gameplay.tscn +++ b/game.tscn @@ -1,22 +1,20 @@ -[gd_scene load_steps=6 format=3 uid="uid://ct7v3x7imstlk"] +[gd_scene load_steps=5 format=3 uid="uid://ct7v3x7imstlk"] [ext_resource type="PackedScene" uid="uid://dd0cxfceqwxca" path="res://prefabs/paddle.tscn" id="1_80nbo"] -[ext_resource type="Script" uid="uid://8lo33im7wrya" path="res://scripts/gameplay.gd" id="1_oe8ih"] -[ext_resource type="Script" uid="uid://wrequpaalk7f" path="res://scripts/ball.gd" id="2_e2o6t"] +[ext_resource type="Script" uid="uid://wrequpaalk7f" path="res://ball.gd" id="2_e2o6t"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_mwb40"] size = Vector2(1200, 20) [sub_resource type="RectangleShape2D" id="RectangleShape2D_feb5d"] -[node name="Gameplay" type="Control"] +[node name="Root" type="Control"] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -script = ExtResource("1_oe8ih") [node name="Background" type="ColorRect" parent="."] layout_mode = 1 @@ -61,12 +59,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("../VBoxContainer/HBoxContainer/Score-0") +score_label = NodePath("../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("../VBoxContainer/HBoxContainer/Score-1") +score_label = NodePath("../HBoxContainer/Score-1") [node name="Ball" type="CharacterBody2D" parent="." node_paths=PackedStringArray("paddle_0", "paddle_1")] position = Vector2(134, 72) @@ -85,37 +83,22 @@ shape = SubResource("RectangleShape2D_feb5d") [node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="Ball"] position = Vector2(110, 85) -[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="VBoxContainer" type="VBoxContainer" parent="."] +[node name="HBoxContainer" type="HBoxContainer" parent="."] layout_mode = 1 -anchors_preset = -1 +anchors_preset = 10 anchor_right = 1.0 -offset_top = 25.0 -offset_bottom = 107.0 +offset_top = 20.0 +offset_bottom = 43.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"] +[node name="Score-0" type="Label" parent="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="VBoxContainer/HBoxContainer"] +[node name="Score-1" type="Label" parent="HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 theme_override_font_sizes/font_size = 40 diff --git a/prefabs/paddle.tscn b/prefabs/paddle.tscn index c21fd8b..923cb05 100644 --- a/prefabs/paddle.tscn +++ b/prefabs/paddle.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=3 format=3 uid="uid://dd0cxfceqwxca"] -[ext_resource type="Script" uid="uid://d0dti6pba80ci" path="res://scripts/Paddle.gd" id="1_q73f6"] +[ext_resource type="Script" uid="uid://d0dti6pba80ci" path="res://Paddle.gd" id="1_q73f6"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_e2o6t"] size = Vector2(33, 105) diff --git a/project.godot b/project.godot index ddeffd4..5994a63 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="2025-08-23 Learning" -run/main_scene="uid://d04c3lqwj6a5h" +run/main_scene="uid://ct7v3x7imstlk" config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" @@ -37,8 +37,3 @@ down-1={ "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":75,"key_label":0,"unicode":107,"location":0,"echo":false,"script":null) ] } -key_exit={ -"deadzone": 0.2, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) -] -} diff --git a/resources/pong_theme.tres b/resources/pong_theme.tres deleted file mode 100644 index ac212a6..0000000 --- a/resources/pong_theme.tres +++ /dev/null @@ -1,98 +0,0 @@ -[gd_resource type="Theme" load_steps=7 format=3 uid="uid://cga6aww0tbilq"] - -[sub_resource type="SystemFont" id="SystemFont_svo66"] - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_svo66"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0.35417196, 0.23284352, 0.33606362, 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_u7j1g"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0.35417196, 0.23284352, 0.33606362, 1) -draw_center = false -border_width_left = 2 -border_width_top = 2 -border_width_right = 2 -border_width_bottom = 2 -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 -expand_margin_left = 2.0 -expand_margin_top = 2.0 -expand_margin_right = 2.0 -expand_margin_bottom = 2.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gwd0w"] -content_margin_left = 136.0 -content_margin_right = 136.0 -bg_color = Color(0.42745098, 0.59607846, 0.7411765, 1) -border_width_left = 7 -border_width_top = 7 -border_width_right = 7 -border_width_bottom = 7 -expand_margin_left = 52.0 -expand_margin_top = 52.0 -expand_margin_right = 52.0 -expand_margin_bottom = 52.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gq8b7"] -content_margin_left = 136.0 -content_margin_right = 136.0 -bg_color = Color(0.20784314, 0.23921569, 0.2901961, 1) -border_width_left = 7 -border_width_top = 7 -border_width_right = 7 -border_width_bottom = 7 -expand_margin_left = 52.0 -expand_margin_top = 52.0 -expand_margin_right = 52.0 -expand_margin_bottom = 52.0 - -[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) -Button/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) -Button/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1) -Button/colors/font_outline_color = Color(0, 0, 0, 1) -Button/colors/font_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_disabled_color = Color(1, 1, 1, 0.4) -Button/colors/icon_focus_color = Color(1, 1, 1, 1) -Button/colors/icon_hover_color = Color(1, 1, 1, 1) -Button/colors/icon_hover_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_normal_color = Color(1, 1, 1, 1) -Button/colors/icon_pressed_color = Color(1, 1, 1, 1) -Button/constants/align_to_largest_stylebox = 0 -Button/constants/h_separation = 10 -Button/constants/icon_max_width = 0 -Button/constants/line_spacing = 6 -Button/constants/outline_size = 4 -Button/font_sizes/font_size = 72 -Button/fonts/font = SubResource("SystemFont_svo66") -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_cek52") diff --git a/scenes/Main.tscn b/scenes/Main.tscn deleted file mode 100644 index ad4a186..0000000 --- a/scenes/Main.tscn +++ /dev/null @@ -1,13 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://dy4s4as4b07s8"] - -[ext_resource type="Script" uid="uid://bi1hbvswrw6yr" path="res://scripts/main.gd" id="1_0bbpv"] -[ext_resource type="PackedScene" uid="uid://d04c3lqwj6a5h" path="res://scenes/Start.tscn" id="2_rarhs"] -[ext_resource type="PackedScene" uid="uid://ct7v3x7imstlk" path="res://scenes/gameplay.tscn" id="3_vcsgt"] - -[node name="Main" type="Node2D"] -script = ExtResource("1_0bbpv") - -[node name="Start" parent="." instance=ExtResource("2_rarhs")] -z_index = 5 - -[node name="Gameplay" parent="." instance=ExtResource("3_vcsgt")] diff --git a/scenes/Start.tscn b/scenes/Start.tscn deleted file mode 100644 index f36f169..0000000 --- a/scenes/Start.tscn +++ /dev/null @@ -1,55 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://d04c3lqwj6a5h"] - -[ext_resource type="Script" uid="uid://d3rocjpvkb3te" path="res://scripts/start.gd" id="1_r305v"] -[ext_resource type="Theme" uid="uid://cga6aww0tbilq" path="res://resources/pong_theme.tres" id="3_gx2gx"] - -[sub_resource type="GDScript" id="GDScript_fx3ca"] -script/source = "extends VBoxContainer -" - -[node name="Start" type="Control"] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -script = ExtResource("1_r305v") - -[node name="ColorRect" type="ColorRect" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0.29000002, 0.402, 0.5, 1) - -[node name="CenterContainer" type="CenterContainer" parent="."] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"] -layout_mode = 2 -theme_override_constants/separation = 175 -script = SubResource("GDScript_fx3ca") - -[node name="Button_Play" type="Button" parent="CenterContainer/VBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 -theme = ExtResource("3_gx2gx") -theme_override_colors/font_color = Color(0.87, 0.87, 0.87, 1) -theme_override_constants/outline_size = 2 -text = "Play" - -[node name="Button_Quit" type="Button" parent="CenterContainer/VBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 -theme = ExtResource("3_gx2gx") -theme_override_colors/font_color = Color(0.87, 0.87, 0.87, 1) -theme_override_constants/outline_size = 2 -text = "Quit" diff --git a/scripts/gameplay.gd b/scripts/gameplay.gd deleted file mode 100644 index 5a12c1e..0000000 --- a/scripts/gameplay.gd +++ /dev/null @@ -1,10 +0,0 @@ -extends Control - -func _ready(): - set_process(true) - -func _process(_delta): - 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") diff --git a/scripts/gameplay.gd.uid b/scripts/gameplay.gd.uid deleted file mode 100644 index d69a9e2..0000000 --- a/scripts/gameplay.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://8lo33im7wrya diff --git a/scripts/start.gd b/scripts/start.gd deleted file mode 100644 index c34a9d9..0000000 --- a/scripts/start.gd +++ /dev/null @@ -1,10 +0,0 @@ -extends Control -func _ready(): - %Button_Play.pressed.connect(play) - %Button_Quit.pressed.connect(quit_game) - -func play(): - get_tree().change_scene_to_file('res://scenes/gameplay.tscn') - -func quit_game(): - get_tree().quit() diff --git a/scripts/start.gd.uid b/scripts/start.gd.uid deleted file mode 100644 index 0e340f6..0000000 --- a/scripts/start.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://d3rocjpvkb3te