Add player movement

This commit is contained in:
Aslan 2026-01-24 12:34:02 -05:00
parent 269b962fef
commit 3f97e18615
27 changed files with 631 additions and 1 deletions

122
scenes/game.tscn Normal file
View file

@ -0,0 +1,122 @@
[gd_scene format=3 uid="uid://b3yh6h7fdt160"]
[ext_resource type="Script" uid="uid://cue3c56axvyja" path="res://scripts/Player.cs" id="1_uwrxv"]
[ext_resource type="Script" uid="uid://cy8nuarxbnd" path="res://scripts/GravityZone.cs" id="1_yqjtg"]
[ext_resource type="Script" uid="uid://bwpdtkgmwjs7g" path="res://scripts/GravityReceiver.cs" id="3_lnu2h"]
[ext_resource type="Script" uid="uid://n557xfrv0i6x" path="res://scripts/GeneralControlManager.cs" id="4_lbhrr"]
[ext_resource type="Script" uid="uid://betypbypf6bf2" path="res://scripts/GameMenuController.cs" id="5_iywne"]
[sub_resource type="PlaneMesh" id="PlaneMesh_8cj0n"]
[sub_resource type="BoxShape3D" id="BoxShape3D_8cj0n"]
size = Vector3(10, 0.5, 10)
[sub_resource type="BoxShape3D" id="BoxShape3D_uwrxv"]
size = Vector3(10, 5, 10)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_8cj0n"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_uwrxv"]
[node name="Game" type="Node3D" unique_id=1201210338]
[node name="Plane2" type="StaticBody3D" parent="." unique_id=289682669]
transform = Transform3D(1, 0, 0, 0, 0.99999994, 0, 0, 0, 0.99999994, -20.320108, 0, 0)
[node name="PlaneMesh" type="MeshInstance3D" parent="Plane2" unique_id=1859317875]
transform = Transform3D(5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0)
mesh = SubResource("PlaneMesh_8cj0n")
[node name="PlaneCollider" type="CollisionShape3D" parent="Plane2" unique_id=907638578]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0)
shape = SubResource("BoxShape3D_8cj0n")
[node name="GravityZone" type="Area3D" parent="Plane2" unique_id=600317513]
gravity_space_override = 2
script = ExtResource("1_yqjtg")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Plane2/GravityZone" unique_id=991265750]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, 0)
shape = SubResource("BoxShape3D_uwrxv")
[node name="Plane" type="StaticBody3D" parent="." unique_id=1260154250]
transform = Transform3D(1, 0, 0, 0, 0.70710677, 0.70710677, 0, -0.70710677, 0.70710677, 0, 0, 0)
[node name="PlaneMesh" type="MeshInstance3D" parent="Plane" unique_id=107049489]
transform = Transform3D(5, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0)
mesh = SubResource("PlaneMesh_8cj0n")
[node name="PlaneCollider" type="CollisionShape3D" parent="Plane" unique_id=970373853]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.2, 0)
shape = SubResource("BoxShape3D_8cj0n")
[node name="GravityZone" type="Area3D" parent="Plane" unique_id=1326543003]
gravity_space_override = 2
script = ExtResource("1_yqjtg")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Plane/GravityZone" unique_id=772916098]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, 0)
shape = SubResource("BoxShape3D_uwrxv")
[node name="Player" type="CharacterBody3D" parent="." unique_id=612572257 node_paths=PackedStringArray("GameMenu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 5.1320534, 0.7854848)
script = ExtResource("1_uwrxv")
GameMenu = NodePath("../GameMenu")
[node name="Camera" type="Camera3D" parent="Player" unique_id=1097983892]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6, 0)
fov = 90.0
[node name="PlayerMesh" type="MeshInstance3D" parent="Player" unique_id=1440613415]
mesh = SubResource("CapsuleMesh_8cj0n")
[node name="PlayerCollider" type="CollisionShape3D" parent="Player" unique_id=886478863]
shape = SubResource("CapsuleShape3D_uwrxv")
[node name="GravityReceiver" type="Node3D" parent="Player" unique_id=1963556576]
script = ExtResource("3_lnu2h")
[node name="OmniLight" type="OmniLight3D" parent="." unique_id=1887866205]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6497431, -4.41529)
omni_range = 95.383
omni_attenuation = 0.254
[node name="GeneralControlManager" type="Node" parent="." unique_id=1751385863 node_paths=PackedStringArray("GameMenu")]
script = ExtResource("4_lbhrr")
GameMenu = NodePath("../GameMenu")
[node name="GameMenu" type="Control" parent="." unique_id=223510406]
visible = false
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("5_iywne")
[node name="Overlay" type="ColorRect" parent="GameMenu" unique_id=255916820]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.2509804)
[node name="VBoxContainer" type="VBoxContainer" parent="GameMenu" unique_id=502136213]
layout_mode = 0
offset_left = 32.0
offset_top = 32.0
offset_right = 128.0
offset_bottom = 63.0
[node name="MainMenuButton" type="Button" parent="GameMenu/VBoxContainer" unique_id=1125420773]
layout_mode = 2
text = "Main Menu"
[connection signal="body_entered" from="Plane2/GravityZone" to="Plane2/GravityZone" method="OnBodyEntered"]
[connection signal="body_exited" from="Plane2/GravityZone" to="Plane2/GravityZone" method="OnBodyExited"]
[connection signal="body_entered" from="Plane/GravityZone" to="Plane/GravityZone" method="OnBodyEntered"]
[connection signal="body_exited" from="Plane/GravityZone" to="Plane/GravityZone" method="OnBodyExited"]
[connection signal="pressed" from="GameMenu/VBoxContainer/MainMenuButton" to="GameMenu" method="OnMainMenu"]

35
scenes/main_menu.tscn Normal file
View file

@ -0,0 +1,35 @@
[gd_scene format=3 uid="uid://bnmh1mebldx4l"]
[ext_resource type="Script" uid="uid://b7inoxterktk3" path="res://scripts/MainMenu/MainMenuController.cs" id="1_l6cm7"]
[node name="MainMenu" type="Control" unique_id=1620629749]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_l6cm7")
[node name="CenterContainer" type="CenterContainer" parent="." unique_id=601944177]
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" unique_id=180209254]
layout_mode = 2
alignment = 1
[node name="StartGameButton" type="Button" parent="CenterContainer/VBoxContainer" unique_id=364461644]
layout_mode = 2
text = "Start Game"
[node name="ExitGameButton" type="Button" parent="CenterContainer/VBoxContainer" unique_id=1050417063]
layout_mode = 2
text = "Exit Game"
[connection signal="pressed" from="CenterContainer/VBoxContainer/StartGameButton" to="." method="OnStartGame"]
[connection signal="pressed" from="CenterContainer/VBoxContainer/ExitGameButton" to="." method="OnExitGame"]