Adds Player controller

This commit is contained in:
Michel 2025-01-31 22:54:00 +01:00
commit ab3890896d
35 changed files with 26403 additions and 0 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Godot 4+ specific ignores
.godot/
/android/
.idea/

27
TestScene.tscn Normal file
View file

@ -0,0 +1,27 @@
[gd_scene load_steps=4 format=3 uid="uid://datin7yogkbf3"]
[ext_resource type="Material" uid="uid://bjhdc2pxcui3" path="res://content/cardboard_material.tres" id="1_64ce8"]
[ext_resource type="PackedScene" uid="uid://ctu0cdqcefrwg" path="res://prefabs/player.tscn" id="2_k3l6b"]
[sub_resource type="BoxShape3D" id="BoxShape3D_jbkga"]
size = Vector3(248.301, 1, 176.535)
[node name="TestScene" type="Node3D"]
[node name="StaticBody3D" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -45.5868, -0.5, -28.2159)
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"]
shape = SubResource("BoxShape3D_jbkga")
[node name="CSGBox3D" type="CSGBox3D" parent="StaticBody3D"]
material_override = ExtResource("1_64ce8")
size = Vector3(248.301, 1, 176.535)
[node name="Node3D" parent="." instance=ExtResource("2_k3l6b")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0230917, 0, -0.0855939)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.951466, 0.283282, -0.120267, 0.221829, -0.360404, 0.906036, 0.213319, -0.888741, -0.405752, 0, 39.7095, 0)
light_energy = 1.861
directional_shadow_pancake_size = 12.9

View file

@ -0,0 +1,28 @@
[gd_resource type="StandardMaterial3D" load_steps=6 format=3 uid="uid://bjhdc2pxcui3"]
[ext_resource type="Texture2D" uid="uid://dnavx8bsrg2cp" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Color.png" id="1_u5ab5"]
[ext_resource type="Texture2D" uid="uid://w1qjoj4t60pe" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Displacement.png" id="2_p176y"]
[ext_resource type="Texture2D" uid="uid://dku7f5fijokpn" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_NormalGL.png" id="3_24st2"]
[ext_resource type="Texture2D" uid="uid://cpmhd8ni4r5lu" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Roughness.png" id="4_ptq0i"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_4ny28"]
[resource]
diffuse_mode = 3
specular_mode = 1
albedo_color = Color(0.521141, 0.521141, 0.521141, 1)
albedo_texture = ExtResource("1_u5ab5")
roughness_texture = ExtResource("4_ptq0i")
normal_enabled = true
normal_scale = 2.89
normal_texture = ExtResource("3_24st2")
heightmap_enabled = true
heightmap_scale = 0.697
heightmap_texture = ExtResource("2_p176y")
heightmap_flip_texture = true
refraction_scale = -0.25
detail_mask = SubResource("CompressedTexture2D_4ny28")
detail_albedo = SubResource("CompressedTexture2D_4ny28")
uv1_scale = Vector3(0.245, 0.245, 0.245)
uv1_triplanar = true
uv1_world_triplanar = true

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 KiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://gqe8dl65vmig"
path.s3tc="res://.godot/imported/Cardboard001.png-5ca1a46c9a78fad87e90bf008a605f2d.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://content/rifle/Cardboard001_2K-PNG/Cardboard001.png"
dest_files=["res://.godot/imported/Cardboard001.png-5ca1a46c9a78fad87e90bf008a605f2d.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View file

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<materialx version="1.38" fileprefix="./">
<standard_surface type="surfaceshader" xpos="6.159420" name="Cardboard001_2K_PNG_StandardSurface" ypos="-1.879310">
<input value="0" type="float" name="specular" />
<input value="1" type="float" name="coat" />
<input value="1, 1, 1" type="color3" name="coat_color" />
<input value="1" type="float" name="base" />
<input type="color3" nodename="Cardboard001_2K_PNG_Color" name="base_color" />
<input type="vector3" nodename="normalmap" name="normal" />
<input type="vector3" nodename="normalmap" name="coat_normal" />
<input type="float" nodename="Cardboard001_2K_PNG_Roughness" name="specular_roughness" />
<input type="float" nodename="Cardboard001_2K_PNG_Roughness" name="coat_roughness" />
</standard_surface>
<surfacematerial type="material" xpos="8.695652" name="Cardboard001_2K_PNG" ypos="0.000000">
<input type="surfaceshader" nodename="Cardboard001_2K_PNG_StandardSurface" name="surfaceshader" />
<input type="displacementshader" nodename="displacement" name="displacementshader" />
</surfacematerial>
<tiledimage type="color3" xpos="3.623188" name="Cardboard001_2K_PNG_Color" ypos="-3.103448">
<input value="Cardboard001_2K-PNG_Color.png" type="filename" colorspace="srgb_texture" name="file" />
<input value="1.0, 1.0" type="vector2" name="uvtiling" />
</tiledimage>
<tiledimage type="float" xpos="3.623188" name="Cardboard001_2K_PNG_Displacement" ypos="5.163793">
<input value="Cardboard001_2K-PNG_Displacement.png" type="filename" name="file" />
<input value="1.0, 1.0" type="vector2" name="uvtiling" />
</tiledimage>
<displacement type="displacementshader" xpos="6.159420" name="displacement" ypos="1.879310">
<input type="float" nodename="Cardboard001_2K_PNG_Displacement" name="displacement" />
<input value="1.0" type="float" name="scale" />
</displacement>
<tiledimage type="vector3" xpos="1.086957" name="Cardboard001_2K_PNG_NormalGL" ypos="0.879310">
<input value="Cardboard001_2K-PNG_NormalGL.png" type="filename" name="file" />
<input value="1.0, 1.0" type="vector2" name="uvtiling" />
</tiledimage>
<normalmap type="vector3" xpos="3.623188" name="normalmap" ypos="3.586207">
<input type="vector3" nodename="Cardboard001_2K_PNG_NormalGL" name="in" />
<input value="1.0" type="float" name="scale" />
</normalmap>
<tiledimage type="float" xpos="3.623188" name="Cardboard001_2K_PNG_Roughness" ypos="-0.413793">
<input value="Cardboard001_2K-PNG_Roughness.png" type="filename" name="file" />
<input value="1.0, 1.0" type="vector2" name="uvtiling" />
</tiledimage>
</materialx>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7 MiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dnavx8bsrg2cp"
path.s3tc="res://.godot/imported/Cardboard001_2K-PNG_Color.png-cf6691eee2a85c7c0483b02ceffbedfa.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Color.png"
dest_files=["res://.godot/imported/Cardboard001_2K-PNG_Color.png-cf6691eee2a85c7c0483b02ceffbedfa.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://w1qjoj4t60pe"
path.s3tc="res://.godot/imported/Cardboard001_2K-PNG_Displacement.png-770b24bb0623300e634b117062e3867d.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Displacement.png"
dest_files=["res://.godot/imported/Cardboard001_2K-PNG_Displacement.png-770b24bb0623300e634b117062e3867d.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 MiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c01npc6jtseip"
path.s3tc="res://.godot/imported/Cardboard001_2K-PNG_NormalDX.png-270145c2c96598c550bc2ca7f4edf203.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_NormalDX.png"
dest_files=["res://.godot/imported/Cardboard001_2K-PNG_NormalDX.png-270145c2c96598c550bc2ca7f4edf203.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_NormalDX.png"
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 MiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dku7f5fijokpn"
path.s3tc="res://.godot/imported/Cardboard001_2K-PNG_NormalGL.png-f1b51900ac4195b68b8c45dadb983d81.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_NormalGL.png"
dest_files=["res://.godot/imported/Cardboard001_2K-PNG_NormalGL.png-f1b51900ac4195b68b8c45dadb983d81.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_NormalGL.png"
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cpmhd8ni4r5lu"
path.s3tc="res://.godot/imported/Cardboard001_2K-PNG_Roughness.png-bd337407c1ef91c130d6be0dc4106199.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Roughness.png"
dest_files=["res://.godot/imported/Cardboard001_2K-PNG_Roughness.png-bd337407c1ef91c130d6be0dc4106199.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View file

@ -0,0 +1,20 @@
[gd_resource type="AnimationNodeBlendSpace1D" load_steps=4 format=3 uid="uid://belbtf6saao12"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_fw2oo"]
animation = &"LVA4_Armature|Fire_1"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_up73k"]
animation = &"LVA4_Armature|Fire_2"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bjhpv"]
animation = &"LVA4_Armature|Fire_3"
[resource]
blend_point_0/node = SubResource("AnimationNodeAnimation_fw2oo")
blend_point_0/pos = 0.0
blend_point_1/node = SubResource("AnimationNodeAnimation_up73k")
blend_point_1/pos = 1.0
blend_point_2/node = SubResource("AnimationNodeAnimation_bjhpv")
blend_point_2/pos = 2.0
min_space = 0.0
max_space = 2.0

View file

@ -0,0 +1,29 @@
[gd_resource type="AnimationNodeBlendSpace2D" load_steps=6 format=3 uid="uid://dh5bnb5xvmv0f"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_glk57"]
animation = &"LVA4_Armature|Idle"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4nam8"]
animation = &"LVA4_Armature|Move_Forward"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_y7e77"]
animation = &"LVA4_Armature|Move_Left"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_hwjyc"]
animation = &"LVA4_Armature|Move_Right"
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_owips"]
animation = &"LVA4_Armature|Move_Forward"
play_mode = 1
[resource]
blend_point_0/node = SubResource("AnimationNodeAnimation_glk57")
blend_point_0/pos = Vector2(0, 0)
blend_point_1/node = SubResource("AnimationNodeAnimation_4nam8")
blend_point_1/pos = Vector2(0, 1)
blend_point_2/node = SubResource("AnimationNodeAnimation_y7e77")
blend_point_2/pos = Vector2(1, 0)
blend_point_3/node = SubResource("AnimationNodeAnimation_hwjyc")
blend_point_3/pos = Vector2(-1, 0)
blend_point_4/node = SubResource("AnimationNodeAnimation_owips")
blend_point_4/pos = Vector2(0, -1)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,44 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bl08vo851jn5x"
path="res://.godot/imported/rifle.fbx-419b40db13c89e1774ce82199c54f15d.scn"
[deps]
source_file="res://content/rifle/rifle.fbx"
dest_files=["res://.godot/imported/rifle.fbx-419b40db13c89e1774ce82199c54f15d.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=0.01
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={
"materials": {
"Material.001": {
"use_external/enabled": true,
"use_external/path": "res://content/rifle/rifle_material.tres"
}
}
}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1

View file

@ -0,0 +1,31 @@
[gd_resource type="StandardMaterial3D" load_steps=6 format=3 uid="uid://bmawvuomui06g"]
[ext_resource type="Texture2D" uid="uid://dnavx8bsrg2cp" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Color.png" id="1_1k1j1"]
[ext_resource type="Texture2D" uid="uid://w1qjoj4t60pe" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Displacement.png" id="2_hlgs7"]
[ext_resource type="Texture2D" uid="uid://dku7f5fijokpn" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_NormalGL.png" id="3_djy0y"]
[ext_resource type="Texture2D" uid="uid://cpmhd8ni4r5lu" path="res://content/rifle/Cardboard001_2K-PNG/Cardboard001_2K-PNG_Roughness.png" id="4_a4f6v"]
[sub_resource type="CurveTexture" id="CurveTexture_oq5c5"]
[resource]
albedo_color = Color(0.31, 0.31, 0.31, 1)
albedo_texture = ExtResource("1_1k1j1")
metallic_specular = 0.02
roughness_texture = ExtResource("4_a4f6v")
normal_enabled = true
normal_scale = 1.7
normal_texture = ExtResource("3_djy0y")
heightmap_enabled = true
heightmap_scale = 2.658
heightmap_deep_parallax = true
heightmap_min_layers = 8
heightmap_max_layers = 32
heightmap_texture = ExtResource("2_hlgs7")
heightmap_flip_texture = true
backlight_enabled = true
backlight = Color(0.666569, 0.666569, 0.666569, 1)
refraction_scale = -0.25
detail_mask = ExtResource("4_a4f6v")
detail_albedo = SubResource("CurveTexture_oq5c5")
uv1_scale = Vector3(4, 4, 4)
grow_amount = -0.103

5845
content/rifle/weapon.tscn Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because it is too large Load diff

19
environment.tres Normal file
View file

@ -0,0 +1,19 @@
[gd_resource type="Environment" load_steps=3 format=3 uid="uid://jn22ygxsbcd4"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_72mw6"]
[sub_resource type="Sky" id="Sky_jar1y"]
sky_material = SubResource("ProceduralSkyMaterial_72mw6")
[resource]
background_mode = 2
sky = SubResource("Sky_jar1y")
ambient_light_source = 3
ambient_light_color = Color(0.834614, 0.834614, 0.834614, 1)
ambient_light_energy = 4.85
reflected_light_source = 2
tonemap_mode = 3
adjustment_enabled = true
adjustment_brightness = 1.03
adjustment_contrast = 1.05
adjustment_saturation = 1.35

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c7clp5rwrilrr"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

33
prefabs/player.tscn Normal file
View file

@ -0,0 +1,33 @@
[gd_scene load_steps=6 format=3 uid="uid://ctu0cdqcefrwg"]
[ext_resource type="Script" path="res://scripts/player/player.gd" id="1_1tqna"]
[ext_resource type="Script" path="res://scripts/player/cameraController.gd" id="1_v2q4i"]
[ext_resource type="PackedScene" uid="uid://c2x0xjb2ypfpq" path="res://content/rifle/weapon.tscn" id="3_5cmgy"]
[ext_resource type="Script" path="res://scripts/player/weapon.gd" id="4_nfpgt"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_w4dyg"]
margin = 0.332
[node name="Player" type="CharacterBody3D"]
axis_lock_angular_x = true
axis_lock_angular_z = true
script = ExtResource("1_1tqna")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CylinderShape3D_w4dyg")
[node name="Camera3D" type="Camera3D" parent="." node_paths=PackedStringArray("PlayerNode")]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 0, 1.68094, 0)
keep_aspect = 0
fov = 80.0
script = ExtResource("1_v2q4i")
PlayerNode = NodePath("..")
[node name="Weapon" parent="Camera3D" instance=ExtResource("3_5cmgy")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.096244, 0)
script = ExtResource("4_nfpgt")
[node name="CooldownTimer" type="Timer" parent="Camera3D/Weapon"]
wait_time = 0.3
one_shot = true

60
project.godot Normal file
View file

@ -0,0 +1,60 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="MJ177"
run/main_scene="res://TestScene.tscn"
config/features=PackedStringArray("4.3", "GL Compatibility")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
[input]
player_left={
"deadzone": 0.5,
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
]
}
player_right={
"deadzone": 0.5,
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
]
}
player_up={
"deadzone": 0.5,
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
]
}
player_down={
"deadzone": 0.5,
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
]
}
player_jump={
"deadzone": 0.5,
"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
]
}
player_shoot={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(83, 17),"global_position":Vector2(92, 63),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
environment/defaults/default_environment="res://environment.tres"

View file

@ -0,0 +1,24 @@
extends Camera3D
@export var PlayerNode: Node3D;
@export var turnSpeed: float = 0.25;
@export var XRotationClamp: Vector2 = Vector2(-90, 90)
var currentRotation: Vector2 = Vector2(0,0);
func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED;
func _input(event: InputEvent) -> void:
if event is not InputEventMouseMotion:
return
var inputRotation = event.relative
self.currentRotation += Vector2(inputRotation.y, inputRotation.x) * self.turnSpeed * -1;
self.currentRotation.x = clamp(currentRotation.x, XRotationClamp.x, XRotationClamp.y);
self.rotation_degrees.x = currentRotation.x;
self.PlayerNode.rotation_degrees.y = currentRotation.y

44
scripts/player/player.gd Normal file
View file

@ -0,0 +1,44 @@
extends CharacterBody3D
@onready var animationtree: AnimationTree = $Camera3D/Weapon/AnimationPlayer/AnimationTree
const SPEED: float = 5.0
const FALLOFF_SPEED: float = 0.5
const JUMP_VELOCITY: float = 4.5
var lastDirection = Vector2(0,0)
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
func _physics_process(delta: float) -> void:
# Add the gravity.
if not is_on_floor():
velocity.y -= gravity * delta
# Handle Jump.
if Input.is_action_just_pressed("player_jump") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir := Input.get_vector("player_right", "player_left", "player_down", "player_up")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
var falloffSpeed = FALLOFF_SPEED
if not is_on_floor():
falloffSpeed = 0.02;
if direction:
velocity.x = direction.x * SPEED
velocity.z = direction.z * SPEED
else:
velocity.x = move_toward(velocity.x, 0, falloffSpeed)
velocity.z = move_toward(velocity.z, 0, falloffSpeed)
move_and_slide()
lastDirection.x = move_toward(lastDirection.x, input_dir.x, 0.05);
lastDirection.y = move_toward(lastDirection.y, input_dir.y, 0.05);
animationtree.set('parameters/Movement/blend_position', lastDirection);

25
scripts/player/weapon.gd Normal file
View file

@ -0,0 +1,25 @@
extends Node3D
@onready var animationtree: AnimationTree = $AnimationPlayer/AnimationTree
@onready var timer: Timer = $CooldownTimer
var statemachine: AnimationNodeStateMachinePlayback
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
self.statemachine = animationtree['parameters/playback']
func _input(event: InputEvent) -> void:
if event is not InputEventMouseButton:
return
if not event.is_action_pressed('player_shoot'):
return
if self.timer.time_left > 0:
return
self.animationtree.set('parameters/Fire/blend_position', randf_range(0, 2))
self.statemachine.travel('Fire')
self.timer.start()

View file

@ -0,0 +1,3 @@
extends AnimationPlayer
@export var animationTree: AnimationTree;