refactor(*): Restructure game into reusable Arena/GameMode architecture with controller-driven ships, adding Free Play and Match modes

This commit is contained in:
Josh Creek
2026-07-18 15:34:11 +01:00
parent 14a8907038
commit 328831df1f
46 changed files with 664 additions and 406 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[gd_scene load_steps=3 format=3 uid="uid://c8kak2l3m4n5"]
[ext_resource type="Script" uid="uid://bx9j8k7l6m5n" path="res://scripts/HUDController.gd" id="1_hud_controller"]
[ext_resource type="Script" uid="uid://du7y176h5aaq4" path="res://scripts/HUDController.gd" id="1_hud_controller"]
[sub_resource type="LabelSettings" id="LabelSettings_hud"]
font_size = 32
@@ -1,10 +1,8 @@
[gd_scene load_steps=11 format=3 uid="uid://b82sy3js0vncb"]
[gd_scene load_steps=9 format=3]
[ext_resource type="Script" uid="uid://bpxm8ge52w5g8" path="res://scripts/game.gd" id="1_iywne"]
[ext_resource type="Script" path="res://scripts/arena.gd" id="1_iywne"]
[ext_resource type="Material" uid="uid://drm3clvqpis42" path="res://assets/models/TerrainMaterial.tres" id="1_lnu2h"]
[ext_resource type="ArrayMesh" uid="uid://cndcxj6gf0smr" path="res://assets/models/Terrain.obj" id="2_lbhrr"]
[ext_resource type="PackedScene" uid="uid://p07epxnh8wwp" path="res://objects/ship.tscn" id="4_iywne"]
[ext_resource type="PackedScene" uid="uid://27u3tdc5yqnl" path="res://objects/ball.tscn" id="5_iywne"]
[ext_resource type="PackedScene" uid="uid://cofdcxo5170rs" path="res://objects/goal.tscn" id="6_p57ef"]
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_kldst"]
@@ -19,7 +17,7 @@ sky_material = SubResource("ProceduralSkyMaterial_iukft")
background_mode = 2
sky = SubResource("Sky_gl6un")
[node name="Game" type="Node3D"]
[node name="Arena" type="Node3D"]
script = ExtResource("1_iywne")
[node name="Terrain" type="StaticBody3D" parent="."]
@@ -38,19 +36,22 @@ shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_j5yw3")
[node name="Timer" type="Timer" parent="."]
process_callback = 0
autostart = true
[node name="GoalTeam0" parent="." instance=ExtResource("6_p57ef")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29962, 0.790881, 15.5633)
[node name="Ship" parent="." instance=ExtResource("4_iywne")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.497204, 2.82216, 27.8553)
lock_rotation = true
[node name="Ball" parent="." instance=ExtResource("5_iywne")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.464103, 1.46401, -2.82393)
mass = 3.0
[node name="Goal" parent="." instance=ExtResource("6_p57ef")]
[node name="GoalTeam1" parent="." instance=ExtResource("6_p57ef")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29962, 0.790881, -15.5633)
team = 1
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
[node name="BallSpawn" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)
[node name="SpawnsTeam0" type="Node3D" parent="."]
[node name="Spawn1" type="Marker3D" parent="SpawnsTeam0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.8, 12)
[node name="SpawnsTeam1" type="Node3D" parent="."]
[node name="Spawn1" type="Marker3D" parent="SpawnsTeam1"]
transform = Transform3D(-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 2.8, -12)
+12
View File
@@ -0,0 +1,12 @@
[gd_scene load_steps=4 format=3]
[ext_resource type="Script" path="res://scripts/free_play.gd" id="1_fp"]
[ext_resource type="PackedScene" path="res://scenes/arena_01.tscn" id="2_fp"]
[ext_resource type="PackedScene" uid="uid://c8kak2l3m4n5" path="res://scenes/HUD.tscn" id="3_fp"]
[node name="FreePlay" type="Node3D"]
script = ExtResource("1_fp")
[node name="Arena" parent="." instance=ExtResource("2_fp")]
[node name="HUD" parent="." instance=ExtResource("3_fp")]
+35 -36
View File
@@ -1,44 +1,43 @@
[gd_scene load_steps=3 format=3 uid="uid://bcq14356s3e2i"]
[gd_scene load_steps=2 format=3 uid="uid://bcq14356s3e2i"]
[ext_resource type="Script" uid="uid://c1tfuurttt8ft" path="res://scripts/main_menu_play_button.gd" id="1_28flt"]
[ext_resource type="Script" path="res://scripts/main_menu.gd" id="1_menu"]
[sub_resource type="LabelSettings" id="LabelSettings_erv1k"]
[node name="MainMenu" type="Node2D"]
[node name="Label" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -51.0
offset_top = -11.0
offset_right = 253.0
offset_bottom = 109.0
[node name="MainMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
script = ExtResource("1_menu")
[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 = 24
[node name="TitleLabel" type="Label" parent="CenterContainer/VBoxContainer"]
layout_mode = 2
theme_override_font_sizes/font_size = 48
text = "Cosmic Clash"
label_settings = SubResource("LabelSettings_erv1k")
horizontal_alignment = 1
vertical_alignment = 1
[node name="Button" type="Button" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = 347.0
offset_top = 233.0
offset_right = 676.0
offset_bottom = 373.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 4
size_flags_vertical = 4
text = "Play"
script = ExtResource("1_28flt")
[node name="FreePlayButton" type="Button" parent="CenterContainer/VBoxContainer"]
custom_minimum_size = Vector2(330, 60)
layout_mode = 2
text = "Free Play"
[connection signal="pressed" from="Button" to="Button" method="_on_pressed"]
[node name="MatchButton" type="Button" parent="CenterContainer/VBoxContainer"]
custom_minimum_size = Vector2(330, 60)
layout_mode = 2
text = "Match"
[connection signal="pressed" from="CenterContainer/VBoxContainer/FreePlayButton" to="." method="_on_free_play_pressed"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/MatchButton" to="." method="_on_match_pressed"]
+12
View File
@@ -0,0 +1,12 @@
[gd_scene load_steps=4 format=3]
[ext_resource type="Script" path="res://scripts/match_mode.gd" id="1_m"]
[ext_resource type="PackedScene" path="res://scenes/arena_01.tscn" id="2_m"]
[ext_resource type="PackedScene" uid="uid://c8kak2l3m4n5" path="res://scenes/HUD.tscn" id="3_m"]
[node name="Match" type="Node3D"]
script = ExtResource("1_m")
[node name="Arena" parent="." instance=ExtResource("2_m")]
[node name="HUD" parent="." instance=ExtResource("3_m")]
+9
View File
@@ -0,0 +1,9 @@
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/ship_camera.gd" id="1_rig"]
[node name="ShipCameraRig" type="Node3D"]
script = ExtResource("1_rig")
[node name="Camera3D" type="Camera3D" parent="."]
current = true