diff --git a/Assets/Materials/floor.tres b/Assets/Materials/floor.tres new file mode 100644 index 0000000..259f650 --- /dev/null +++ b/Assets/Materials/floor.tres @@ -0,0 +1,14 @@ +[gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://cr4ra7ijk1uec"] + +[ext_resource type="Texture2D" uid="uid://dmywcofis4bkh" path="res://Assets/Textures/stone_2_gray_0.png" id="1_adegu"] + +[resource] +albedo_texture = ExtResource("1_adegu") +emission_enabled = true +emission = Color(1, 1, 1, 1) +emission_energy_multiplier = 0.05 +subsurf_scatter_strength = 1.0 +uv1_scale = Vector3(3, 2, 1) +uv1_triplanar_sharpness = 0.0583145 +uv2_triplanar_sharpness = 0.170755 +texture_filter = 0 diff --git a/Assets/Textures/church_0.png b/Assets/Textures/church_0.png new file mode 100644 index 0000000..4fd15d9 Binary files /dev/null and b/Assets/Textures/church_0.png differ diff --git a/Assets/Textures/church_0.png.import b/Assets/Textures/church_0.png.import new file mode 100644 index 0000000..0d00d6d --- /dev/null +++ b/Assets/Textures/church_0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c1kbx6r2wr4s5" +path="res://.godot/imported/church_0.png-0bb62c2cd9ef6f8c8b8a9385a8b84d23.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/church_0.png" +dest_files=["res://.godot/imported/church_0.png-0bb62c2cd9ef6f8c8b8a9385a8b84d23.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 diff --git a/Assets/Textures/cobalt_stone_4.png b/Assets/Textures/cobalt_stone_4.png new file mode 100644 index 0000000..9b6cb84 Binary files /dev/null and b/Assets/Textures/cobalt_stone_4.png differ diff --git a/Assets/Textures/cobalt_stone_4.png.import b/Assets/Textures/cobalt_stone_4.png.import new file mode 100644 index 0000000..93dd73c --- /dev/null +++ b/Assets/Textures/cobalt_stone_4.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dd150xco2ee5q" +path="res://.godot/imported/cobalt_stone_4.png-2f556b8c80fb9db7f21adb51a7786967.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/cobalt_stone_4.png" +dest_files=["res://.godot/imported/cobalt_stone_4.png-2f556b8c80fb9db7f21adb51a7786967.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 diff --git a/Assets/Textures/crystal_floor_0.png b/Assets/Textures/crystal_floor_0.png new file mode 100644 index 0000000..79c6194 Binary files /dev/null and b/Assets/Textures/crystal_floor_0.png differ diff --git a/Assets/Textures/crystal_floor_0.png.import b/Assets/Textures/crystal_floor_0.png.import new file mode 100644 index 0000000..ee6de93 --- /dev/null +++ b/Assets/Textures/crystal_floor_0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cuxfe4lobcjrd" +path="res://.godot/imported/crystal_floor_0.png-b744e33cb5e930747430f06e80744c94.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/crystal_floor_0.png" +dest_files=["res://.godot/imported/crystal_floor_0.png-b744e33cb5e930747430f06e80744c94.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 diff --git a/Assets/Textures/crystal_wall_2.png b/Assets/Textures/crystal_wall_2.png new file mode 100644 index 0000000..a4c89ea Binary files /dev/null and b/Assets/Textures/crystal_wall_2.png differ diff --git a/Assets/Textures/crystal_wall_2.png.import b/Assets/Textures/crystal_wall_2.png.import new file mode 100644 index 0000000..34c6873 --- /dev/null +++ b/Assets/Textures/crystal_wall_2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dc23iehev1s8w" +path="res://.godot/imported/crystal_wall_2.png-43c04d21b06c37d08c09bdfa81be4afe.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/crystal_wall_2.png" +dest_files=["res://.godot/imported/crystal_wall_2.png-43c04d21b06c37d08c09bdfa81be4afe.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 diff --git a/Assets/Textures/ice_0_old.png b/Assets/Textures/ice_0_old.png new file mode 100644 index 0000000..a396053 Binary files /dev/null and b/Assets/Textures/ice_0_old.png differ diff --git a/Assets/Textures/ice_0_old.png.import b/Assets/Textures/ice_0_old.png.import new file mode 100644 index 0000000..1bd0b94 --- /dev/null +++ b/Assets/Textures/ice_0_old.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c1fesrqdpjloa" +path="res://.godot/imported/ice_0_old.png-7cda17758c5aa18a266b9d5b33aba6c0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/ice_0_old.png" +dest_files=["res://.godot/imported/ice_0_old.png-7cda17758c5aa18a266b9d5b33aba6c0.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 diff --git a/Assets/Textures/rect_gray_0_old.png b/Assets/Textures/rect_gray_0_old.png new file mode 100644 index 0000000..fd83747 Binary files /dev/null and b/Assets/Textures/rect_gray_0_old.png differ diff --git a/Assets/Textures/rect_gray_0_old.png.import b/Assets/Textures/rect_gray_0_old.png.import new file mode 100644 index 0000000..10c8572 --- /dev/null +++ b/Assets/Textures/rect_gray_0_old.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cubqlybfo1q3r" +path="res://.godot/imported/rect_gray_0_old.png-807f3bb9249ff79f864fa4ceefd71090.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/rect_gray_0_old.png" +dest_files=["res://.godot/imported/rect_gray_0_old.png-807f3bb9249ff79f864fa4ceefd71090.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 diff --git a/Assets/Textures/stone_2_dark_0.png b/Assets/Textures/stone_2_dark_0.png new file mode 100644 index 0000000..f80422b Binary files /dev/null and b/Assets/Textures/stone_2_dark_0.png differ diff --git a/Assets/Textures/stone_2_dark_0.png.import b/Assets/Textures/stone_2_dark_0.png.import new file mode 100644 index 0000000..67e3c01 --- /dev/null +++ b/Assets/Textures/stone_2_dark_0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bdpdhwywerhnu" +path="res://.godot/imported/stone_2_dark_0.png-b41635e52a7d59c9a2cc8b975e836c38.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/stone_2_dark_0.png" +dest_files=["res://.godot/imported/stone_2_dark_0.png-b41635e52a7d59c9a2cc8b975e836c38.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 diff --git a/Assets/Textures/stone_2_gray_0.png b/Assets/Textures/stone_2_gray_0.png new file mode 100644 index 0000000..fd04eba Binary files /dev/null and b/Assets/Textures/stone_2_gray_0.png differ diff --git a/Assets/Textures/stone_2_gray_0.png.import b/Assets/Textures/stone_2_gray_0.png.import new file mode 100644 index 0000000..ee27d88 --- /dev/null +++ b/Assets/Textures/stone_2_gray_0.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dmywcofis4bkh" +path.s3tc="res://.godot/imported/stone_2_gray_0.png-9d16a4858afb7acd70485069983b75ce.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://Assets/Textures/stone_2_gray_0.png" +dest_files=["res://.godot/imported/stone_2_gray_0.png-9d16a4858afb7acd70485069983b75ce.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 diff --git a/Assets/Textures/stone_gray_0.png b/Assets/Textures/stone_gray_0.png new file mode 100644 index 0000000..1d67f59 Binary files /dev/null and b/Assets/Textures/stone_gray_0.png differ diff --git a/Assets/Textures/stone_gray_0.png.import b/Assets/Textures/stone_gray_0.png.import new file mode 100644 index 0000000..5a8584a --- /dev/null +++ b/Assets/Textures/stone_gray_0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c5xawy2clung6" +path="res://.godot/imported/stone_gray_0.png-64fe0587f09af2b9bf9bc63b97dca05e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/stone_gray_0.png" +dest_files=["res://.godot/imported/stone_gray_0.png-64fe0587f09af2b9bf9bc63b97dca05e.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 diff --git a/Assets/Textures/white_marble_0.png b/Assets/Textures/white_marble_0.png new file mode 100644 index 0000000..c73c7f1 Binary files /dev/null and b/Assets/Textures/white_marble_0.png differ diff --git a/Assets/Textures/white_marble_0.png.import b/Assets/Textures/white_marble_0.png.import new file mode 100644 index 0000000..c4e6e20 --- /dev/null +++ b/Assets/Textures/white_marble_0.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://rqtcsf0bqlje" +path="res://.godot/imported/white_marble_0.png-633ce60960cf39f2124328d8fffb59e9.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Textures/white_marble_0.png" +dest_files=["res://.godot/imported/white_marble_0.png-633ce60960cf39f2124328d8fffb59e9.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 diff --git a/Levels/TestZone.tscn b/Levels/TestZone.tscn index ca2420d..3006444 100644 --- a/Levels/TestZone.tscn +++ b/Levels/TestZone.tscn @@ -1,12 +1,207 @@ -[gd_scene load_steps=8 format=3 uid="uid://bojbawyoy11i4"] +[gd_scene load_steps=12 format=3 uid="uid://bojbawyoy11i4"] -[ext_resource type="Texture2D" uid="uid://contqwyu7r114" path="res://icon.svg" id="1_gnwph"] [ext_resource type="Script" path="res://Scripts/Player.gd" id="2_0sf88"] +[ext_resource type="Material" uid="uid://cr4ra7ijk1uec" path="res://Assets/Materials/floor.tres" id="2_8fy0v"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kgnq8"] -albedo_texture = ExtResource("1_gnwph") +[sub_resource type="Shader" id="Shader_gv186"] +code = "shader_type spatial; + +#define USE_ALPHA 0 +#define USE_ALPHA_CUTOFF 0 +#define USE_EMISSION 0 +#define USE_REFLECTIONS 0 +#define USE_NORMAL_MAP 0 +#define USE_OCCLUSION 0 +#define USE_ANISOTROPY 0 +#define USE_BACKLIGHT 0 +#define USE_REFRACTION 0 + +#if USE_ALPHA +render_mode depth_draw_always; +#endif + +#include \"includes/base-cel-shader.gdshaderinc\" + +#if USE_EMISSION +#include \"includes/emission.gdshaderinc\" +#endif + +#if USE_REFLECTIONS +#include \"includes/reflections.gdshaderinc\" +#endif + +#if USE_NORMAL_MAP +#include \"includes/normal-map.gdshaderinc\" +#endif + +#if USE_OCCLUSION +#include \"includes/occlusion.gdshaderinc\" +#endif + +#if USE_ANISOTROPY +#include \"includes/anisotropy.gdshaderinc\" +#endif + +#if USE_BACKLIGHT +#include \"includes/backlight.gdshaderinc\" +#endif + +#if USE_REFRACTION +#include \"includes/refraction.gdshaderinc\" +#elif !USE_REFRACTION && USE_ALPHA +#include \"includes/transparency.gdshaderinc\" +#endif + +group_uniforms BaseProperties; +#if USE_ALPHA_CUTOFF +uniform float alpha_cutoff: hint_range(0.0, 1.0) = 0.5; +#endif +uniform vec4 color: source_color = vec4(0.7, 0.12, 0.86, 1.0); +uniform sampler2D base_texture: source_color; +uniform vec4 specular: source_color = vec4(0.3, 0.3, 0.3, 0.5); +uniform sampler2D specular_texture: hint_default_white; +uniform vec4 fresnel: source_color = vec4(0.2, 0.2, 0.2, 0.3); +uniform sampler2D fresnel_texture: hint_default_white; +group_uniforms; + +varying vec3 SPECULAR_COLOR; +varying float SPECULAR_STRENGTH; +varying vec3 FRESNEL_COLOR; +varying float FRESNEL_STRENGTH; + +group_uniforms Tiling; +uniform vec2 uv_scale = vec2(1,1); +uniform vec2 uv_offset = vec2(0,0); +group_uniforms; + + +void vertex() { + UV = UV * uv_scale.xy + uv_offset.xy; +} + +void fragment() { + ALBEDO = color.rgb * texture(base_texture, UV).rgb; +#if USE_ALPHA + float alpha = color.a * texture(base_texture, UV).a; + ALBEDO *= alpha; +#elif USE_ALPHA_CUTOFF + ALPHA = color.a * texture(base_texture, UV).a; + ALPHA_SCISSOR_THRESHOLD = color.a * texture(base_texture, UV).a; +#endif + +#if USE_REFRACTION && USE_ALPHA + EMISSION += refraction_fragment(alpha, NORMAL, SCREEN_UV, FRAGCOORD.z); +#elif !USE_REFRACTION && USE_ALPHA + EMISSION += transparency_fragment(alpha, SCREEN_UV); +#endif + + SPECULAR_COLOR = specular.rgb * texture(specular_texture, UV).rgb; + SPECULAR_STRENGTH = specular.a * texture(specular_texture, UV).a; + FRESNEL_COLOR = fresnel.rgb * texture(fresnel_texture, UV).rgb; + FRESNEL_STRENGTH = fresnel.a * texture(fresnel_texture, UV).a; + +#if USE_EMISSION + EMISSION += emission_fragment(UV); +#endif + +#if USE_REFLECTIONS + Surface surf = reflections_fragment(UV); + METALLIC = surf.metallic; + ROUGHNESS = surf.roughness; +#endif + +#if USE_NORMAL_MAP + NormalData normal = normal_map_fragment(UV, NORMAL, TANGENT, BINORMAL); + NORMAL = normal.vector; + NORMAL_MAP = normal.map; + NORMAL_MAP_DEPTH = normal.depth; +#endif + +#if USE_OCCLUSION + OcclusionData occlusion = occlusion_fragment(UV); + AO = occlusion.ao; + AO_LIGHT_AFFECT = occlusion.ao_light_affect; +#endif + +#if USE_ANISOTROPY + AnisotropyData aniso = anisotropy_fragment(UV); + ANISOTROPY_DIR = aniso.direction; + ANISOTROPY_RATIO = aniso.ratio; +#endif + +#if USE_BACKLIGHT + BACKLIGHT = backlight_fragment(UV); +#endif +} + +void light() { +#if USE_BACKLIGHT + DIFFUSE_LIGHT += backlight_diffuse( + ALBEDO, + LIGHT_COLOR, + LIGHT, + NORMAL, + ATTENUATION, + BACKLIGHT + ); +#else + DIFFUSE_LIGHT += diffuse_light( + ALBEDO, + LIGHT_COLOR, + LIGHT, + NORMAL, + ATTENUATION + ); +#endif + +#if USE_ANISOTROPY + SPECULAR_LIGHT += anisotropy_specular( + LIGHT_COLOR, + SPECULAR_COLOR, + SPECULAR_STRENGTH, + NORMAL, + VIEW, + LIGHT, + ATTENUATION, + UV, + ANISOTROPY_DIR, + ANISOTROPY_RATIO + ); +#else + SPECULAR_LIGHT += specular_light( + LIGHT_COLOR, + SPECULAR_COLOR, + SPECULAR_STRENGTH, + NORMAL, + VIEW, + LIGHT, + ATTENUATION + ); +#endif + + SPECULAR_LIGHT += fresnel_light( + LIGHT_COLOR, + FRESNEL_COLOR, + FRESNEL_STRENGTH, + NORMAL, + VIEW, + LIGHT, + ATTENUATION + ); +} +" + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_0th4j"] +render_priority = 0 +shader = SubResource("Shader_gv186") +shader_parameter/color = Color(1, 1, 1, 1) +shader_parameter/specular = Color(0.3, 0.3, 0.3, 0.5) +shader_parameter/fresnel = Color(0.2, 0.2, 0.2, 0.3) +shader_parameter/uv_scale = Vector2(1, 1) +shader_parameter/uv_offset = Vector2(0, 0) [sub_resource type="BoxMesh" id="BoxMesh_67chd"] +material = SubResource("ShaderMaterial_0th4j") size = Vector3(10, 1, 10) [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_drsh3"] @@ -16,10 +211,24 @@ data = PackedVector3Array(-5, 0.5, 5, 5, 0.5, 5, -5, -0.5, 5, 5, 0.5, 5, 5, -0.5 [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_a6eig"] +[sub_resource type="BoxMesh" id="BoxMesh_21vdj"] +material = ExtResource("2_8fy0v") + +[sub_resource type="BoxShape3D" id="BoxShape3D_nndy8"] + +[sub_resource type="MeshLibrary" id="MeshLibrary_udrkc"] +item/0/name = "dsa" +item/0/mesh = SubResource("BoxMesh_21vdj") +item/0/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/0/shapes = [SubResource("BoxShape3D_nndy8"), Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)] +item/0/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +item/0/navigation_layers = 1 + [node name="TestZone" type="Node3D"] [node name="MeshInstance3D" type="MeshInstance3D" parent="."] -material_override = SubResource("StandardMaterial3D_kgnq8") +process_mode = 4 +visible = false mesh = SubResource("BoxMesh_67chd") [node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D"] @@ -27,9 +236,21 @@ mesh = SubResource("BoxMesh_67chd") [node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D"] shape = SubResource("ConcavePolygonShape3D_drsh3") -[node name="Player" type="CharacterBody3D" parent="."] +[node name="MeshInstance3D2" type="MeshInstance3D" parent="."] +process_mode = 4 +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.95936, 0.687725, -3.34325) +visible = false +mesh = SubResource("BoxMesh_67chd") + +[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D2"] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D2/StaticBody3D"] +shape = SubResource("ConcavePolygonShape3D_drsh3") + +[node name="Player" type="CharacterBody3D" parent="." node_paths=PackedStringArray("camera")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.83982, 0) script = ExtResource("2_0sf88") +camera = NodePath("Camera3D") [node name="MeshInstance3D2" type="MeshInstance3D" parent="Player"] mesh = SubResource("CapsuleMesh_5q2rg") @@ -43,5 +264,14 @@ shape = SubResource("CapsuleShape3D_a6eig") [node name="OmniLight3D" type="OmniLight3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.94042, 0) +light_color = Color(0.69761, 0.418962, 0.0472636, 1) omni_range = 15.748 omni_attenuation = 0.210224 + +[node name="GridMap" type="GridMap" parent="."] +mesh_library = SubResource("MeshLibrary_udrkc") +cell_size = Vector3(1, 1, 1) +data = { +"cells": PackedInt32Array(65533, 65534, 851968, 65532, 65534, 851968, 65533, 65533, 851968, 65532, 65533, 851968, 65534, 65531, 851968, 65533, 65531, 851968, 65532, 65531, 851968, 65531, 65531, 851968, 65530, 65531, 851968, 65529, 65531, 851968, 65532, 65526, 851968, 65531, 65526, 851968, 65530, 65526, 851968, 65529, 65526, 851968, 65528, 65526, 851968, 65527, 65526, 851968, 65526, 65526, 851968, 65525, 65526, 851968, 65526, 65525, 851968, 65527, 65525, 851968, 65528, 65525, 851968, 65529, 65525, 851968, 65530, 65525, 851968, 65531, 65525, 851968, 65532, 65525, 851968, 65533, 65525, 851968, 65525, 65525, 851968, 65524, 65525, 851968, 65524, 65526, 851968, 65523, 65525, 851968, 65523, 65526, 851968, 65522, 65527, 851968, 65523, 65527, 851968, 65523, 65528, 851968, 65523, 65529, 851968, 65523, 65530, 851968, 65523, 65531, 851968, 65523, 65532, 851968, 196595, 65525, 851968, 196596, 65525, 851968, 196597, 65525, 851968, 196598, 65525, 851968, 196599, 65525, 851968, 196600, 65525, 851968, 196601, 65525, 851968, 196602, 65525, 851968, 196603, 65525, 851968, 196604, 65525, 851968, 196605, 65526, 851968, 196604, 65526, 851968, 196603, 65526, 851968, 196602, 65526, 851968, 196601, 65526, 851968, 196600, 65526, 851968, 196599, 65526, 851968, 196598, 65526, 851968, 196597, 65526, 851968, 196596, 65526, 851968, 196595, 65526, 851968, 196594, 65526, 851968, 131059, 65526, 851968, 131060, 65526, 851968, 131061, 65526, 851968, 131062, 65526, 851968, 131062, 65527, 851968, 131063, 65527, 851968, 131064, 65527, 851968, 131065, 65527, 851968, 131066, 65527, 851968, 131066, 65526, 851968, 131067, 65526, 851968, 131068, 65526, 851968, 131065, 65526, 851968, 131064, 65526, 851968, 131063, 65526, 851968, 131064, 3, 851968, 131063, 3, 851968, 131062, 3, 851968, 131062, 4, 851968, 131063, 4, 851968, 131063, 5, 786432, 131064, 5, 786432, 131065, 5, 786432, 131065, 4, 983040, 131064, 4, 851968, 131068, 8, 851968, 131063, 9, 786432, 131056, 0, 786432, 131059, 5, 786432, 131058, 5, 786432, 131057, 5, 786432, 131056, 5, 786432, 131056, 4, 786432, 131055, 4, 786432, 131055, 3, 786432, 131055, 2, 786432, 131056, 2, 786432, 131056, 1, 786432, -65550, 0, 786432, -65549, 0, 786432, -13, 0, 786432, -12, 0, 786432, 65524, 0, 786432, 65523, 0, 786432, 131059, 0, 786432, 131058, 0, 786432, 65522, 0, 786432, -14, 0, 786432, 65521, 0, 786432, -15, 0, 786432, 196594, 0, 786432, 196593, 0, 786432, 131057, 0, 786432, 65520, 0, 786432, -16, 0, 786432, -65551, 0, 786432, -131087, 0, 786432, -196623, 0, 786432, -196622, 0, 786432, -131086, 0, 786432, 262130, 0, 786432, 262129, 0, 786432, 327665, 0, 786432, 262128, 0, 786432, 196592, 0, 786432, -196621, 0, 786432, -131085, 0, 786432, -65548, 0, 786432, 196595, 0, 786432, -262158, 0, 786432, -262157, 0, 786432, -131084, 0, 786432, -65547, 0, 786432, -11, 0, 786432, 65525, 0, 786432, 131061, 0, 786432, 196597, 0, 786432, 196596, 0, 786432, 262132, 0, 786432, 327667, 0, 786432, 393203, 0, 786432, 393202, 0, 786432, 393201, 0, 786432, 327664, 0, 786432, 131055, 0, 786432, 65519, 0, 786432, -17, 0, 786432, -65552, 0, 786432, -131088, 0, 786432, -262160, 0, 786432, -327694, 0, 786432, -327693, 0, 786432, -262156, 0, 786432, -196620, 0, 786432, 131060, 0, 786432, 262131, 0, 786432, 327666, 0, 786432, -65553, 0, 786432, -131089, 0, 786432, -196625, 0, 786432, -196624, 0, 786432, -262159, 0, 786432, -327695, 0, 786432, 131062, 5, 786432, 131062, 6, 786432, 131062, 7, 786432, 131062, 8, 786432, 131062, 9, 786432, 131063, 6, 786432, 131063, 7, 786432, 131063, 8, 786432, 131064, 6, 786432, 131064, 7, 786432, 131064, 8, 786432, 131064, 9, 786432, 131065, 6, 786432, 131065, 7, 786432, 131065, 8, 786432, 131065, 9, 786432, 131066, 5, 786432, 131066, 6, 786432, 131066, 7, 786432, 131066, 8, 786432, 131066, 9, 786432, 131067, 5, 983040, 131067, 6, 786432, 131067, 7, 786432, 131067, 8, 786432, 131067, 9, 786432, 131065, 3, 983040, 131066, 4, 983040, 131068, 5, 983040, 131068, 6, 983040, 131067, 4, 983040, 131066, 3, 983040, 131066, 2, 983040, 131065, 2, 983040, 131067, 3, 983040, 131069, 6, 983040, 131069, 5, 983040, 131068, 4, 983040, 131067, 2, 983040, 131066, 1, 983040, 131068, 3, 983040, 131069, 4, 983040, 131070, 5, 983040, 131070, 6, 983040, 131068, 2, 983040, 131070, 4, 983040, 131071, 5, 983040, 131069, 3, 983040, 131068, 1, 983040, 131069, 1, 983040, 131070, 2, 983040, 131070, 3, 983040, 131071, 3, 983040, 131069, 2, 983040, 131068, 0, 983040, 65536, 5, 983040, 131071, 4, 983040, 65536, 4, 983040, 131070, 1, 983040, 131071, 2, 983040, 65536, 3, 983040, 65534, 0, 983040, 65534, 1, 983040, 65535, 1, 983040, 0, 1, 983040, 65533, 0, 983040, 65535, 0, 983040, 0, 0, 983040, 1, 0, 983040, 1, 1, 983040, 2, 1, 983040, 65533, 65535, 983040, 65532, 65535, 983040, 65534, 65535, 983040, 65535, 65535, 983040, 2, 0, 983040, 0, 65535, 983040, 65534, 65534, 983040, 65535, 65534, 983040, 1, 65535, 983040, 2, 65535, 983040, 0, 65534, 983040, 1, 65534, 983040, 65535, 65533, 983040, 65534, 65533, 983040, 0, 65533, 983040, 2, 65534, 983040, 1, 65533, 983040) +} +metadata/_editor_floor_ = Vector3(0, 0, 0) diff --git a/Scripts/Player.gd b/Scripts/Player.gd index 91c388e..db577ce 100644 --- a/Scripts/Player.gd +++ b/Scripts/Player.gd @@ -1,5 +1,7 @@ extends CharacterBody3D +@export var camera : Camera3D +@export var mouse_sensitivity : float = 0.003 # TODO: this is sketchy check that its framerate independant pls const SPEED = 5.0 const JUMP_VELOCITY = 4.5 @@ -7,6 +9,8 @@ const JUMP_VELOCITY = 4.5 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") +func _ready(): + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED func _physics_process(delta): # Add the gravity. @@ -14,12 +18,19 @@ func _physics_process(delta): velocity.y -= gravity * delta # Handle jump. - if Input.is_action_just_pressed("ui_accept") and is_on_floor(): + if Input.is_action_just_pressed("jump") and is_on_floor(): velocity.y = JUMP_VELOCITY + + #free the mouse for debugging + if Input.is_action_just_pressed("esc"): + if (Input.mouse_mode == Input.MOUSE_MODE_CAPTURED): + Input.mouse_mode = Input.MOUSE_MODE_VISIBLE + else: + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED # 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("ui_left", "ui_right", "ui_up", "ui_down") + var input_dir = Input.get_vector("mov_left", "mov_right", "mov_up", "mov_down") var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized() if direction: velocity.x = direction.x * SPEED @@ -29,3 +40,11 @@ func _physics_process(delta): velocity.z = move_toward(velocity.z, 0, SPEED) move_and_slide() + + +func _input(event): + # camera control + if event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: + rotate_y(-event.relative.x * mouse_sensitivity) + camera.rotate_x(-event.relative.y * mouse_sensitivity) + camera.rotation.x = clampf(camera.rotation.x, -deg_to_rad(70), deg_to_rad(70)) diff --git a/Scripts/fpsController.gd b/Scripts/fpsController.gd deleted file mode 100644 index 350caa6..0000000 --- a/Scripts/fpsController.gd +++ /dev/null @@ -1,12 +0,0 @@ -extends Node3D - -@export var camera : Camera3D - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta): - pass diff --git a/TODO.txt b/TODO.txt index d86b57e..db39496 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,3 +4,4 @@ - [ ] level deign - [ ] level funciton - [ ] command functions +- [ ] test camera controls for framerate independance diff --git a/project.godot b/project.godot index 5d45833..517bd98 100644 --- a/project.godot +++ b/project.godot @@ -14,3 +14,40 @@ config/name="Chrono Chamber" run/main_scene="res://Levels/TestZone.tscn" config/features=PackedStringArray("4.2", "Forward Plus") config/icon="res://icon.svg" + +[input] + +mov_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,"echo":false,"script":null) +] +} +mov_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,"echo":false,"script":null) +] +} +mov_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,"echo":false,"script":null) +] +} +mov_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,"echo":false,"script":null) +] +} +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,"echo":false,"script":null) +] +} +esc={ +"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":4194305,"key_label":0,"unicode":0,"echo":false,"script":null) +] +} + +[rendering] + +textures/canvas_textures/default_texture_filter=0