diff --git a/assets/textures/terrain/rock62_albedo_height.png b/assets/textures/terrain/rock62_albedo_height.png new file mode 100644 index 0000000..11c0fed --- /dev/null +++ b/assets/textures/terrain/rock62_albedo_height.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0109067d7e9fcb98d50bb16218ad0c110a865a91052e85b4afff6d405bf137d1 +size 7072725 diff --git a/assets/textures/terrain/rock62_albedo_height.png.import b/assets/textures/terrain/rock62_albedo_height.png.import new file mode 100644 index 0000000..9a45094 --- /dev/null +++ b/assets/textures/terrain/rock62_albedo_height.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://qnc3xba5b375" +path.s3tc="res://.godot/imported/rock62_albedo_height.png-595d4ff43a11fa3521a62074cabc3c79.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/terrain/rock62_albedo_height.png" +dest_files=["res://.godot/imported/rock62_albedo_height.png-595d4ff43a11fa3521a62074cabc3c79.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=2 +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=1 diff --git a/assets/textures/terrain/rock62_normal_roughness.png b/assets/textures/terrain/rock62_normal_roughness.png new file mode 100644 index 0000000..20433c3 --- /dev/null +++ b/assets/textures/terrain/rock62_normal_roughness.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4149cd28b56a65345a84e3c4154a319797b7e4fad6f015ff77c83f3a8e33fdca +size 10564885 diff --git a/assets/textures/terrain/rock62_normal_roughness.png.import b/assets/textures/terrain/rock62_normal_roughness.png.import new file mode 100644 index 0000000..e1c595d --- /dev/null +++ b/assets/textures/terrain/rock62_normal_roughness.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dfe7k5rhns8ce" +path.s3tc="res://.godot/imported/rock62_normal_roughness.png-adf2632ed8aa28a9e91c093a68b3c25c.s3tc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://assets/textures/terrain/rock62_normal_roughness.png" +dest_files=["res://.godot/imported/rock62_normal_roughness.png-adf2632ed8aa28a9e91c093a68b3c25c.s3tc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=2 +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=1 diff --git a/project.godot b/project.godot index 971f151..1731d76 100644 --- a/project.godot +++ b/project.godot @@ -86,6 +86,11 @@ open_inventory={ "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":73,"key_label":0,"unicode":105,"location":0,"echo":false,"script":null) ] } +interact={ +"deadzone": 0.2, +"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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null) +] +} [layer_names] diff --git a/src/resources/terrain_data/grassy_hills/terrain3d-01-01.res b/src/resources/terrain_data/grassy_hills/terrain3d-01-01.res index a016eb3..3f1a23e 100644 --- a/src/resources/terrain_data/grassy_hills/terrain3d-01-01.res +++ b/src/resources/terrain_data/grassy_hills/terrain3d-01-01.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9b17af24b150f156bfb7f47f91f69b394b18cd41c326e5ac39b433bba0267115 -size 225193 +oid sha256:d1cfd9a6b68a62821cfda3e0e13373754dd4bca36724b8c04a57448c40129493 +size 225199 diff --git a/src/resources/terrain_data/grassy_hills/terrain3d_00-01.res b/src/resources/terrain_data/grassy_hills/terrain3d_00-01.res index 8990709..7a4e7e9 100644 --- a/src/resources/terrain_data/grassy_hills/terrain3d_00-01.res +++ b/src/resources/terrain_data/grassy_hills/terrain3d_00-01.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3129483b9a417d1802360bf8923b949d2f6bad45161b86037d481b0ddc6d66a2 -size 209253 +oid sha256:5f0cb09b3cff156d5cc51806ba91d13f84aa54dcfe7367f0388bb045f75e2479 +size 213100 diff --git a/src/resources/terrain_data/grassy_hills/terrain3d_00_00.res b/src/resources/terrain_data/grassy_hills/terrain3d_00_00.res index fcb80cf..fb7a515 100644 --- a/src/resources/terrain_data/grassy_hills/terrain3d_00_00.res +++ b/src/resources/terrain_data/grassy_hills/terrain3d_00_00.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5269fe80853f2e08bc1e5c827b9fb4d8d0ed9fb31f8b5b721e37dc343082809f -size 222605 +oid sha256:fc14acc475468d6b6d42139885d1e4b315e88ea07536359388f66e1b3f98af2e +size 222572 diff --git a/src/resources/terrain_data/grassy_hills/terrain3d_01-01.res b/src/resources/terrain_data/grassy_hills/terrain3d_01-01.res index ae430a4..827e57f 100644 --- a/src/resources/terrain_data/grassy_hills/terrain3d_01-01.res +++ b/src/resources/terrain_data/grassy_hills/terrain3d_01-01.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a7684222188585d3122468900d5e1156dd2b008a44299646ebe0eba3f6ef85af -size 228565 +oid sha256:48ae0844fc43ec0d01ec24bd83f2732173f34d0a2ad4d7c6bae1cb16df001e93 +size 228563 diff --git a/src/resources/terrain_data/grassy_hills/terrain3d_01_00.res b/src/resources/terrain_data/grassy_hills/terrain3d_01_00.res index 65f6a42..da9a5f7 100644 --- a/src/resources/terrain_data/grassy_hills/terrain3d_01_00.res +++ b/src/resources/terrain_data/grassy_hills/terrain3d_01_00.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b3a7e537ff81a61375ffbcc172585d8ea2d6fe6966ba4ac68370aa82a004082e -size 222505 +oid sha256:b8605d5d6b26832dddd509756b29236314ed93250caac5346ac91c04d2f5571a +size 222506 diff --git a/src/scenes/characters/player.tscn b/src/scenes/characters/player.tscn index 4278139..80cba33 100644 --- a/src/scenes/characters/player.tscn +++ b/src/scenes/characters/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://nsv4lbw7j8mi"] +[gd_scene load_steps=15 format=3 uid="uid://nsv4lbw7j8mi"] [ext_resource type="Script" uid="uid://csgybabwb8cbg" path="res://src/scripts/characters/player.gd" id="1_swhsd"] [ext_resource type="PackedScene" uid="uid://dw8f5oy13cdtx" path="res://src/scenes/characters/health_component.tscn" id="2_0xash"] @@ -8,6 +8,7 @@ [ext_resource type="Script" uid="uid://blbnvx6pe37mc" path="res://src/scripts/characters/attack_cast.gd" id="4_cx3ie"] [ext_resource type="PackedScene" uid="uid://bo62qyfwylypa" path="res://src/scenes/characters/area_attack.tscn" id="6_wmokw"] [ext_resource type="PackedScene" uid="uid://cwdsfw1g1607y" path="res://src/scenes/characters/dash.tscn" id="7_yvk1n"] +[ext_resource type="Script" uid="uid://dn7ggmw2uipln" path="res://src/scripts/characters/interaction_cast.gd" id="8_n7yyv"] [ext_resource type="PackedScene" uid="uid://blex30jj7g55d" path="res://src/scenes/ui/user_interface.tscn" id="9_wdvff"] [sub_resource type="Resource" id="Resource_wdvff"] @@ -18,6 +19,8 @@ metadata/_custom_type_script = "uid://dwysfismpgq07" [sub_resource type="SeparationRayShape3D" id="SeparationRayShape3D_swhsd"] +[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_wdvff"] + [node name="Player" type="CharacterBody3D" groups=["Player"]] collision_layer = 5 script = ExtResource("1_swhsd") @@ -48,53 +51,53 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) [node name="Rig" parent="RigPivot" instance=ExtResource("3_n52bt")] [node name="Skeleton3D" parent="RigPivot/Rig/CharacterRig/GameRig" index="0"] -bones/0/position = Vector3(7.09508e-15, 0.893464, -0.0481735) +bones/0/position = Vector3(3.37508e-15, 0.891862, -0.0481736) bones/0/rotation = Quaternion(0.12582, 1.18262e-07, 1.49989e-08, 0.992053) bones/1/rotation = Quaternion(-0.0566577, -0.00072973, -0.0117082, 0.998325) bones/2/position = Vector3(3.20474e-09, 0.146689, -1.95578e-08) -bones/2/rotation = Quaternion(-0.00413898, -0.000453312, 0.00321554, 0.999986) +bones/2/rotation = Quaternion(-0.00449009, -0.000459002, 0.00321567, 0.999985) bones/3/position = Vector3(-2.01263e-09, 0.202058, -2.51457e-08) -bones/3/rotation = Quaternion(-0.0986435, -0.000408047, 0.00851862, 0.995086) +bones/3/rotation = Quaternion(-0.0995123, -0.000419335, 0.00851796, 0.995) bones/4/position = Vector3(3.02934e-10, 0.0925562, 3.91155e-08) -bones/4/rotation = Quaternion(0.279031, 1.42965e-08, 9.58451e-08, 0.960282) +bones/4/rotation = Quaternion(0.278904, 1.42911e-08, 9.58138e-08, 0.960319) bones/5/rotation = Quaternion(-0.0948564, -2.80691e-14, -2.26155e-08, 0.995491) -bones/6/rotation = Quaternion(-0.153682, -1.1805e-07, -1.66655e-08, 0.98812) -bones/7/position = Vector3(-3.73163e-08, 0.893464, -0.0481735) +bones/6/rotation = Quaternion(-0.153673, -1.17858e-07, -1.78885e-08, 0.988122) +bones/7/position = Vector3(-3.23587e-08, 0.891862, -0.0481735) bones/7/rotation = Quaternion(-0.0863677, -0.751104, -0.383052, 0.530711) -bones/8/position = Vector3(-6.46306e-08, 0.893464, -0.0481735) +bones/8/position = Vector3(-4.86593e-08, 0.891862, -0.0481735) bones/8/rotation = Quaternion(-0.0863677, 0.751104, 0.383052, 0.530711) -bones/9/position = Vector3(0.131144, 0.959669, -0.0351291) -bones/9/rotation = Quaternion(0.992629, 0.0210668, -0.0308582, 0.115292) +bones/9/position = Vector3(0.131144, 0.958067, -0.0351291) +bones/9/rotation = Quaternion(0.992474, 0.021142, -0.0308232, 0.116611) bones/10/position = Vector3(-2.36129e-08, 0.26601, -2.14789e-08) bones/10/rotation = Quaternion(-3.13921e-08, -0.000695086, 1.20449e-08, 1) bones/11/position = Vector3(-4.6306e-08, 0.26601, 2.42145e-08) -bones/11/rotation = Quaternion(0.428685, -0.000700655, 0.000332591, 0.903454) +bones/11/rotation = Quaternion(0.431734, -0.000700548, 0.000335439, 0.902) bones/12/position = Vector3(3.05151e-08, 0.22603, 5.03768e-08) bones/12/rotation = Quaternion(-8.19226e-09, -0.00710644, 4.16102e-08, 0.999975) bones/13/position = Vector3(-2.95495e-08, 0.22603, 2.68392e-09) -bones/13/rotation = Quaternion(-0.755242, 0.0118989, 0.0244239, 0.654882) +bones/13/rotation = Quaternion(-0.756783, 0.0119047, 0.0244327, 0.653101) bones/14/position = Vector3(-3.05481e-08, 0.139877, 1.64787e-08) bones/14/rotation = Quaternion(-9.66743e-05, 0.967474, -0.252972, -0.000383447) -bones/15/position = Vector3(-0.131144, 0.959669, -0.0351291) -bones/15/rotation = Quaternion(0.972276, -0.00595415, 0.0272024, 0.232174) +bones/15/position = Vector3(-0.131144, 0.958067, -0.0351291) +bones/15/rotation = Quaternion(0.972138, -0.00597952, 0.0271847, 0.232749) bones/16/position = Vector3(-1.10042e-08, 0.265705, -3.31989e-08) bones/16/rotation = Quaternion(-3.43227e-08, 0.00314323, 8.33075e-10, 0.999995) bones/17/position = Vector3(1.83545e-08, 0.265705, 6.98543e-10) -bones/17/rotation = Quaternion(0.452199, 0.00333857, -0.00169272, 0.891909) +bones/17/rotation = Quaternion(0.455056, 0.00335542, -0.00171483, 0.890455) bones/18/position = Vector3(1.2807e-08, 0.225719, -8.28774e-09) bones/18/rotation = Quaternion(-2.29017e-08, -0.00785732, 3.30149e-08, 0.999969) bones/19/position = Vector3(-1.27748e-08, 0.225719, 1.12004e-08) -bones/19/rotation = Quaternion(-0.691654, -0.0282109, -0.000485535, 0.721678) +bones/19/rotation = Quaternion(-0.692156, -0.0282135, -0.000449152, 0.721196) bones/20/position = Vector3(-1.30142e-08, 0.139877, -2.77457e-09) bones/20/rotation = Quaternion(-9.96472e-05, 0.967461, -0.253021, -0.000383039) -bones/21/position = Vector3(0.0251286, 1.42378, 0.0411122) -bones/21/rotation = Quaternion(-0.49895, -0.255619, -0.395929, 0.727288) -bones/22/position = Vector3(0.187703, 1.46001, -0.0274246) -bones/22/rotation = Quaternion(0.0571877, -0.15856, 0.974039, -0.151117) +bones/21/position = Vector3(0.0251286, 1.42316, 0.040874) +bones/21/rotation = Quaternion(-0.501707, -0.254446, -0.393926, 0.726891) +bones/22/position = Vector3(0.187412, 1.45863, -0.0286662) +bones/22/rotation = Quaternion(0.0606331, -0.158025, 0.973831, -0.151677) bones/23/position = Vector3(-5.41331e-09, 0.143946, -2.98023e-08) -bones/23/rotation = Quaternion(9.53832e-08, -0.0099599, 3.09824e-08, 0.99995) +bones/23/rotation = Quaternion(7.97521e-08, -0.00786971, -1.50795e-08, 0.999969) bones/24/position = Vector3(-6.33301e-08, 0.143946, 4.3873e-08) -bones/24/rotation = Quaternion(0.285236, -0.00996051, -0.0172099, 0.958251) +bones/24/rotation = Quaternion(0.277839, -0.00675305, -0.016611, 0.96046) bones/25/position = Vector3(1.30385e-08, 0.127601, 6.51926e-09) bones/25/rotation = Quaternion(1.49943e-07, -1.20606e-07, 9.91859e-08, 1) bones/26/position = Vector3(2.06034e-08, 0.127601, 2.42761e-08) @@ -119,14 +122,14 @@ bones/42/rotation = Quaternion(-0.120913, 0.799109, 0.0358921, 0.587807) bones/43/rotation = Quaternion(0.498693, -0.0202705, -0.0256953, 0.866161) bones/44/rotation = Quaternion(0.715385, 0.035306, 0.0573145, 0.695481) bones/45/rotation = Quaternion(-0.129059, 0.728936, -0.0250259, 0.67184) -bones/46/position = Vector3(-0.0113635, 1.42378, 0.0411122) -bones/46/rotation = Quaternion(-0.522324, 0.208091, 0.3633, 0.742892) -bones/47/position = Vector3(-0.163825, 1.46028, -0.0475648) -bones/47/rotation = Quaternion(-0.0928796, -0.13376, 0.971684, 0.171206) +bones/46/position = Vector3(-0.0113635, 1.42316, 0.040874) +bones/46/rotation = Quaternion(-0.527917, 0.201753, 0.357521, 0.743491) +bones/47/position = Vector3(-0.161977, 1.45794, -0.0515628) +bones/47/rotation = Quaternion(-0.101804, -0.132181, 0.97079, 0.172428) bones/48/position = Vector3(1.88476e-07, 0.143946, 1.02445e-08) -bones/48/rotation = Quaternion(-3.50108e-08, 0.00150091, -6.22347e-08, 0.999999) +bones/48/rotation = Quaternion(-6.49339e-08, -0.0048348, -1.07477e-07, 0.999988) bones/49/position = Vector3(6.5191e-09, 0.143946, -1.95094e-08) -bones/49/rotation = Quaternion(0.316005, 0.00150125, 0.0287075, 0.948322) +bones/49/rotation = Quaternion(0.307483, -0.00462725, 0.0284921, 0.951116) bones/50/position = Vector3(-1.48779e-07, 0.1276, 5.9139e-08) bones/50/rotation = Quaternion(-8.73115e-08, 2.7474e-08, -1.28057e-07, 1) bones/51/position = Vector3(1.9461e-07, 0.127601, 6.06248e-08) @@ -152,19 +155,19 @@ bones/67/rotation = Quaternion(0.108364, -0.768224, 0.166291, 0.608635) bones/68/rotation = Quaternion(0.629954, 0.0295149, 0.0177509, 0.775869) bones/69/rotation = Quaternion(0.816678, -0.0439534, -0.0509861, 0.573155) bones/70/rotation = Quaternion(-0.12906, -0.728937, 0.0250258, 0.67184) -bones/71/position = Vector3(0.127191, 1.34164, -0.0268338) -bones/71/rotation = Quaternion(1.90554e-08, 0.616731, 0.787174, -4.65543e-08) -bones/72/position = Vector3(-0.113426, 1.34164, -0.0268338) -bones/72/rotation = Quaternion(1.90555e-08, 0.616731, 0.787174, -4.65542e-08) +bones/71/position = Vector3(0.127191, 1.34018, -0.0270091) +bones/71/rotation = Quaternion(1.89147e-08, 0.618777, 0.785567, -4.66285e-08) +bones/72/position = Vector3(-0.113426, 1.34018, -0.0270091) +bones/72/rotation = Quaternion(1.89148e-08, 0.618777, 0.785567, -4.66284e-08) [node name="RightHandBone" parent="RigPivot/Rig" index="2"] -transform = Transform3D(-0.962344, -0.270799, -0.0237172, 0.245247, -0.902541, 0.353942, -0.117253, 0.334797, 0.934967, -0.337641, 0.975371, -0.0443394) +transform = Transform3D(-0.962416, -0.270569, -0.0234052, 0.247334, -0.908828, 0.335944, -0.112168, 0.317529, 0.941591, -0.335735, 0.971392, -0.0526208) [node name="LeftHandBone" parent="RigPivot/Rig" index="3"] -transform = Transform3D(-0.970514, 0.239107, 0.030522, -0.224293, -0.942171, 0.249014, 0.0882979, 0.234825, 0.968019, 0.344513, 0.964664, -0.0589395) +transform = Transform3D(-0.970321, 0.239754, 0.0315476, -0.226072, -0.945683, 0.233613, 0.0858439, 0.219548, 0.971817, 0.344388, 0.96235, -0.0640138) [node name="RayAttachment" type="BoneAttachment3D" parent="RigPivot/Rig"] -transform = Transform3D(-0.962344, -0.270799, -0.0237172, 0.245247, -0.902541, 0.353942, -0.117253, 0.334797, 0.934967, -0.337641, 0.975371, -0.0443394) +transform = Transform3D(-0.962416, -0.270569, -0.0234052, 0.247334, -0.908828, 0.335944, -0.112168, 0.317529, 0.941591, -0.335735, 0.971392, -0.0526208) bone_name = "DEF-hand.R" bone_idx = 51 use_external_skeleton = true @@ -181,6 +184,14 @@ script = ExtResource("4_cx3ie") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1) collision_mask = 8 +[node name="InteractionCast" type="ShapeCast3D" parent="RigPivot" node_paths=PackedStringArray("ui")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("CapsuleShape3D_wdvff") +target_position = Vector3(0, 0, 1) +collision_mask = 2 +script = ExtResource("8_n7yyv") +ui = NodePath("../../UserInterface") + [node name="Dash" parent="RigPivot" node_paths=PackedStringArray("player") instance=ExtResource("7_yvk1n")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.191783, 0) player = NodePath("../..") @@ -188,6 +199,10 @@ player = NodePath("../..") [node name="UserInterface" parent="." node_paths=PackedStringArray("player") instance=ExtResource("9_wdvff")] player = NodePath("..") +[node name="InteractContainer" parent="UserInterface/HUD" index="1"] +visible = false +modulate = Color(1, 1, 1, 0) + [node name="Inventory" parent="UserInterface" index="1" node_paths=PackedStringArray("player")] player = NodePath("../..") diff --git a/src/scenes/levels/level.tscn b/src/scenes/levels/level.tscn index bbbfd5f..0011286 100644 --- a/src/scenes/levels/level.tscn +++ b/src/scenes/levels/level.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://dw0lbkh31rofd"] +[gd_scene load_steps=35 format=3 uid="uid://dw0lbkh31rofd"] [ext_resource type="Script" uid="uid://bmywk4wvcp0lr" path="res://addons/sky_3d/src/Sky3D.gd" id="1_1jhfv"] [ext_resource type="Texture2D" uid="uid://bpamrp14tk2cp" path="res://assets/textures/terrain/sand_albedo_height.png" id="1_7iny7"] @@ -8,12 +8,18 @@ [ext_resource type="PackedScene" uid="uid://b1fe4n68iivfm" path="res://assets/models/environment/rock_cliff_env_03.glb" id="2_d2tjv"] [ext_resource type="Script" uid="uid://27fj74ofndim" path="res://addons/sky_3d/src/Skydome.gd" id="2_juj6f"] [ext_resource type="Script" uid="uid://bm0hx4mklpml" path="res://addons/sky_3d/src/TimeOfDay.gd" id="3_0eo66"] +[ext_resource type="Texture2D" uid="uid://qnc3xba5b375" path="res://assets/textures/terrain/rock62_albedo_height.png" id="4_m8n0u"] [ext_resource type="PackedScene" uid="uid://cc8f6ggvpabbi" path="res://assets/models/environment/wall_stone_gate_bldg_01.glb" id="5_0eo66"] +[ext_resource type="Texture2D" uid="uid://dfe7k5rhns8ce" path="res://assets/textures/terrain/rock62_normal_roughness.png" id="5_tbe37"] [ext_resource type="PackedScene" uid="uid://blv7opxftdc6o" path="res://assets/models/environment/stone_wall_bldg_04.glb" id="6_dn2un"] [ext_resource type="PackedScene" uid="uid://cwvrti8hmxj0k" path="res://src/scenes/characters/enemy.tscn" id="6_uvsco"] [ext_resource type="PackedScene" uid="uid://dqkuaw84gl1t2" path="res://assets/models/environment/turret_square_bldg_02.glb" id="7_7iny7"] [ext_resource type="PackedScene" uid="uid://dv1316xdw1rxm" path="res://assets/models/environment/house_modular_01.glb" id="8_cxs0p"] +[ext_resource type="PackedScene" uid="uid://8iicuufue8k5" path="res://src/scenes/structures/chest.tscn" id="9_856t6"] [ext_resource type="PackedScene" uid="uid://6dmbuecqolod" path="res://src/scenes/structures/fire_pit.tscn" id="10_juj6f"] +[ext_resource type="PackedScene" uid="uid://cyhw4ocljvikh" path="res://src/scenes/ui/currency_icon.tscn" id="10_vltgv"] +[ext_resource type="PackedScene" uid="uid://yp4mabfdyo6h" path="res://src/scenes/ui/armor_icon.tscn" id="11_b2fxt"] +[ext_resource type="PackedScene" uid="uid://yyxkltwrme4l" path="res://src/scenes/ui/weapon_icon.tscn" id="12_htor1"] [ext_resource type="PackedScene" uid="uid://jf0abtmnencg" path="res://src/scenes/environment/water.tscn" id="15_0slur"] [sub_resource type="Gradient" id="Gradient_0eo66"] @@ -39,12 +45,16 @@ noise = SubResource("FastNoiseLite_dn2un") [sub_resource type="Terrain3DMaterial" id="Terrain3DMaterial_cxs0p"] _shader_parameters = { +&"auto_base_texture": 1, +&"auto_height_reduction": 0.1, +&"auto_overlay_texture": 0, +&"auto_slope": 5.243, &"bias_distance": 512.0, &"blend_sharpness": 0.87, &"depth_blur": 0.0, &"enable_macro_variation": true, &"enable_projection": true, -&"height_blending": true, +&"height_blending": false, &"macro_variation1": Color(1, 1, 1, 1), &"macro_variation2": Color(1, 1, 1, 1), &"macro_variation_slope": 0.333, @@ -57,17 +67,9 @@ _shader_parameters = { &"noise_texture": SubResource("NoiseTexture2D_7iny7"), &"projection_angular_division": 2.0, &"projection_threshold": 0.8, -&"world_noise_fragment_normals": false, -&"world_noise_height": 64.0, -&"world_noise_lod_distance": 7500.0, -&"world_noise_max_octaves": 4, -&"world_noise_min_octaves": 2, -&"world_noise_offset": Vector3(0, 0, 0), -&"world_noise_region_blend": 0.33, -&"world_noise_scale": 5.0, &"world_space_normal_blend": true } -world_background = 2 +auto_shader = true [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0slur"] transparency = 4 @@ -94,9 +96,16 @@ albedo_texture = ExtResource("1_7iny7") normal_texture = ExtResource("2_cxs0p") roughness = 0.286 +[sub_resource type="Terrain3DTextureAsset" id="Terrain3DTextureAsset_nedwn"] +name = "rock62_albedo_height" +id = 1 +albedo_color = Color(0.93545, 0.990754, 1, 1) +albedo_texture = ExtResource("4_m8n0u") +normal_texture = ExtResource("5_tbe37") + [sub_resource type="Terrain3DAssets" id="Terrain3DAssets_vltgv"] mesh_list = Array[Terrain3DMeshAsset]([SubResource("Terrain3DMeshAsset_856t6")]) -texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_0slur")]) +texture_list = Array[Terrain3DTextureAsset]([SubResource("Terrain3DTextureAsset_0slur"), SubResource("Terrain3DTextureAsset_nedwn")]) [sub_resource type="PhysicalSkyMaterial" id="PhysicalSkyMaterial_dn2un"] energy_multiplier = 4.0 @@ -134,7 +143,7 @@ top_level = true metadata/_edit_lock_ = true [node name="FirePit" parent="NavigationRegion3D" instance=ExtResource("10_juj6f")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.96342, 89.7915, 3.24593) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 41.2201, 94.5773, -58.0352) [node name="Castle" type="Node3D" parent="NavigationRegion3D"] @@ -168,6 +177,24 @@ transform = Transform3D(0.93598, 0, -0.352054, 0, 1, 0, 0.352054, 0, 0.93598, 45 [node name="house_modular_02" parent="NavigationRegion3D/Castle" instance=ExtResource("8_cxs0p")] transform = Transform3D(0.611071, 0, -0.791576, 0, 1, 0, 0.791576, 0, 0.611071, 55.9864, 94.5589, -60.0366) +[node name="Interactible" type="Node3D" parent="NavigationRegion3D"] + +[node name="Chest" parent="NavigationRegion3D/Interactible" instance=ExtResource("9_856t6")] +transform = Transform3D(0.478554, 0, 0.878058, 0, 1, 0, -0.878058, 0, 0.478554, 47.9001, 94.6013, -69.1724) + +[node name="CurrencyIcon" parent="NavigationRegion3D/Interactible/Chest" instance=ExtResource("10_vltgv")] +visible = false +value = 600 + +[node name="ArmorIcon" parent="NavigationRegion3D/Interactible/Chest" instance=ExtResource("11_b2fxt")] +visible = false +power = 10 +armor = 1 + +[node name="WeaponIcon" parent="NavigationRegion3D/Interactible/Chest" instance=ExtResource("12_htor1")] +visible = false +power = 12 + [node name="Sky3D" type="WorldEnvironment" parent="."] environment = SubResource("Environment_cxs0p") camera_attributes = SubResource("CameraAttributesPractical_0slur") @@ -297,7 +324,7 @@ longitude = 108.0 utc = 7.0 [node name="Player" parent="." instance=ExtResource("1_crbv0")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.00648, 91.0205, 2.32963) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 40.8443, 95.6024, -61.289) [node name="MapBoundary" type="Node3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 106.891, 0) diff --git a/src/scenes/structures/chest.tscn b/src/scenes/structures/chest.tscn new file mode 100644 index 0000000..6b6586a --- /dev/null +++ b/src/scenes/structures/chest.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=4 format=3 uid="uid://8iicuufue8k5"] + +[ext_resource type="Script" uid="uid://lo6t7u4km0rf" path="res://src/scripts/structures/chest.gd" id="1_aqdr3"] +[ext_resource type="PackedScene" uid="uid://bcirkaivp1ia6" path="res://assets/models/environment/chest_prop.glb" id="1_jaelo"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_aqdr3"] +size = Vector3(0.822266, 0.75293, 1.20801) + +[node name="Chest" type="StaticBody3D"] +collision_layer = 3 +script = ExtResource("1_aqdr3") + +[node name="chest_prop" parent="." instance=ExtResource("1_jaelo")] + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.376465, 0) +shape = SubResource("BoxShape3D_aqdr3") diff --git a/src/scenes/ui/armor_icon.tscn b/src/scenes/ui/armor_icon.tscn new file mode 100644 index 0000000..c5e935c --- /dev/null +++ b/src/scenes/ui/armor_icon.tscn @@ -0,0 +1,9 @@ +[gd_scene load_steps=3 format=3 uid="uid://yp4mabfdyo6h"] + +[ext_resource type="PackedScene" uid="uid://b35w0afp1fdpg" path="res://src/scenes/ui/item_icon.tscn" id="1_djls0"] +[ext_resource type="Script" uid="uid://dccbhlja0hs4f" path="res://src/scripts/ui/armor_icon.gd" id="2_f0yql"] + +[node name="ArmorIcon" instance=ExtResource("1_djls0")] +script = ExtResource("2_f0yql") +power = 0 +armor = 0 diff --git a/src/scenes/ui/currency_icon.tscn b/src/scenes/ui/currency_icon.tscn new file mode 100644 index 0000000..9c2061c --- /dev/null +++ b/src/scenes/ui/currency_icon.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=3 uid="uid://cyhw4ocljvikh"] + +[ext_resource type="PackedScene" uid="uid://b35w0afp1fdpg" path="res://src/scenes/ui/item_icon.tscn" id="1_nrwbg"] +[ext_resource type="Texture2D" uid="uid://dlpp51vowtel0" path="res://assets/ui/icons/star_icon.png" id="2_31j0q"] +[ext_resource type="Script" uid="uid://wfl5wn2etfof" path="res://src/scripts/ui/currency_icon.gd" id="2_t0sd8"] + +[node name="CurrencyIcon" instance=ExtResource("1_nrwbg")] +script = ExtResource("2_t0sd8") +value = 54 + +[node name="TypeIcon" parent="." index="0"] +texture = ExtResource("2_31j0q") + +[node name="StatLabel" parent="MarginContainer" index="0"] +text = "99" + +[node name="ItemNameLabel" parent="MarginContainer" index="1"] +text = "Gold" diff --git a/src/scenes/ui/item_icon.tscn b/src/scenes/ui/item_icon.tscn new file mode 100644 index 0000000..7b0f81a --- /dev/null +++ b/src/scenes/ui/item_icon.tscn @@ -0,0 +1,75 @@ +[gd_scene load_steps=10 format=3 uid="uid://b35w0afp1fdpg"] + +[ext_resource type="Texture2D" uid="uid://dd48efbhydh3d" path="res://assets/ui/icons/spell_slot_empty_icon.png" id="1_4uo1w"] +[ext_resource type="Texture2D" uid="uid://db4ch7g0so6x0" path="res://assets/ui/icons/item_press_icon.png" id="2_7vh2f"] +[ext_resource type="Texture2D" uid="uid://nq8epkbfjs4a" path="res://assets/ui/icons/item_hover_icon.png" id="3_cdq5c"] +[ext_resource type="Script" uid="uid://caylfrnj8yf8d" path="res://src/scripts/ui/item_icon.gd" id="4_7vh2f"] +[ext_resource type="Texture2D" uid="uid://b6hpoyr0q8y7q" path="res://assets/ui/icons/armor_icon.png" id="4_vxuy4"] +[ext_resource type="FontFile" uid="uid://sua821wsaeli" path="res://assets/fonts/Candara_Bold.ttf" id="5_ls738"] +[ext_resource type="FontFile" uid="uid://d3s081dnj7ea4" path="res://assets/fonts/Candara_Italic.ttf" id="6_bsdv0"] + +[sub_resource type="LabelSettings" id="LabelSettings_3d7gt"] +font = ExtResource("5_ls738") +font_size = 24 +font_color = Color(0.835294, 0.627451, 0.356863, 1) +shadow_color = Color(0, 0, 0, 1) + +[sub_resource type="LabelSettings" id="LabelSettings_4d063"] +font = ExtResource("6_bsdv0") +font_color = Color(0.835294, 0.627451, 0.356863, 1) +shadow_color = Color(0, 0, 0, 1) + +[node name="ItemIcon" type="TextureButton"] +custom_minimum_size = Vector2(128, 128) +offset_right = 40.0 +offset_bottom = 40.0 +texture_normal = ExtResource("1_4uo1w") +texture_pressed = ExtResource("2_7vh2f") +texture_hover = ExtResource("3_cdq5c") +ignore_texture_size = true +stretch_mode = 0 +script = ExtResource("4_7vh2f") + +[node name="TypeIcon" type="TextureRect" parent="."] +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -44.0 +offset_top = -45.0 +offset_right = 44.0 +offset_bottom = 45.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("4_vxuy4") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 18 +theme_override_constants/margin_top = 13 +theme_override_constants/margin_right = 17 +theme_override_constants/margin_bottom = 15 + +[node name="StatLabel" type="Label" parent="MarginContainer"] +layout_mode = 2 +size_flags_vertical = 1 +text = "+99" +label_settings = SubResource("LabelSettings_3d7gt") +horizontal_alignment = 2 + +[node name="ItemNameLabel" type="Label" parent="MarginContainer"] +layout_mode = 2 +size_flags_vertical = 1 +text = "Item name" +label_settings = SubResource("LabelSettings_4d063") +horizontal_alignment = 1 +vertical_alignment = 2 + +[connection signal="gui_input" from="." to="." method="_on_gui_input"] diff --git a/src/scenes/ui/shield_icon.tscn b/src/scenes/ui/shield_icon.tscn new file mode 100644 index 0000000..1201efb --- /dev/null +++ b/src/scenes/ui/shield_icon.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=5 format=3 uid="uid://dbypidud1gcqw"] + +[ext_resource type="PackedScene" uid="uid://b35w0afp1fdpg" path="res://src/scenes/ui/item_icon.tscn" id="1_oou45"] +[ext_resource type="Texture2D" uid="uid://buss4u0qqd2h2" path="res://assets/ui/icons/shield_icon.png" id="2_8lgmn"] +[ext_resource type="Script" uid="uid://bksew7p0rbve6" path="res://src/scripts/ui/shield_icon.gd" id="2_sf0ao"] +[ext_resource type="PackedScene" uid="uid://c7ahf78h5s3kx" path="res://assets/models/character/gear/tall_shield.glb" id="3_sf0ao"] + +[node name="ShieldIcon" instance=ExtResource("1_oou45")] +offset_right = 128.0 +offset_bottom = 128.0 +script = ExtResource("2_sf0ao") +item_name = "Shield" +protection = 20 +item_model = ExtResource("3_sf0ao") + +[node name="TypeIcon" parent="." index="0"] +texture = ExtResource("2_8lgmn") diff --git a/src/scenes/ui/user_interface.tscn b/src/scenes/ui/user_interface.tscn index bb10838..777318e 100644 --- a/src/scenes/ui/user_interface.tscn +++ b/src/scenes/ui/user_interface.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://blex30jj7g55d"] +[gd_scene load_steps=14 format=3 uid="uid://blex30jj7g55d"] [ext_resource type="Texture2D" uid="uid://b7gexelwfg2wp" path="res://assets/ui/unitframe/health_bar_under.png" id="1_qhv2u"] [ext_resource type="Script" uid="uid://5d05pjburasd" path="res://src/scripts/ui/user_interface.gd" id="1_xba4v"] @@ -6,6 +6,7 @@ [ext_resource type="Texture2D" uid="uid://bvwedh6c8rvg" path="res://assets/ui/unitframe/main_bar.png" id="3_j2uiq"] [ext_resource type="FontFile" uid="uid://xseb06nenn48" path="res://assets/fonts/Candara.ttf" id="3_nxqqf"] [ext_resource type="Texture2D" uid="uid://dn2npqh8ue3vy" path="res://assets/ui/unitframe/blue_bar.png" id="4_ma5hf"] +[ext_resource type="FontFile" uid="uid://sua821wsaeli" path="res://assets/fonts/Candara_Bold.ttf" id="7_1j7ss"] [ext_resource type="PackedScene" uid="uid://csadps2at3npv" path="res://src/scenes/ui/inventory.tscn" id="7_70hpn"] [sub_resource type="LabelSettings" id="LabelSettings_xba4v"] @@ -13,6 +14,72 @@ font = ExtResource("3_nxqqf") font_size = 26 font_color = Color(0.960784, 0.717647, 0.423529, 1) +[sub_resource type="LabelSettings" id="LabelSettings_g5kcc"] +font = ExtResource("7_1j7ss") +font_size = 36 +shadow_color = Color(0, 0, 0, 1) + +[sub_resource type="Animation" id="Animation_1j7ss"] +resource_name = "fade_out_text" +length = 0.3 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("HUD/InteractContainer:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.3), +"transitions": PackedFloat32Array(-2, -2), +"update": 1, +"values": [true, false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("HUD/InteractContainer:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.3), +"transitions": PackedFloat32Array(-2, -2), +"update": 0, +"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] +} + +[sub_resource type="Animation" id="Animation_g5kcc"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("HUD/InteractContainer:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("HUD/InteractContainer:modulate") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 1, 1, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_71tnq"] +_data = { +&"RESET": SubResource("Animation_g5kcc"), +&"fade_out_text": SubResource("Animation_1j7ss") +} + [node name="UserInterface" type="Control"] process_mode = 3 layout_mode = 3 @@ -24,7 +91,7 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_xba4v") -[node name="MarginContainer" type="MarginContainer" parent="."] +[node name="HUD" type="MarginContainer" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -37,17 +104,17 @@ theme_override_constants/margin_top = 32 theme_override_constants/margin_right = 32 theme_override_constants/margin_bottom = 32 -[node name="InfoBar" type="Control" parent="MarginContainer"] +[node name="InfoBar" type="Control" parent="HUD"] layout_mode = 2 mouse_filter = 2 -[node name="HealthBarUnder" type="TextureRect" parent="MarginContainer/InfoBar"] +[node name="HealthBarUnder" type="TextureRect" parent="HUD/InfoBar"] layout_mode = 0 offset_right = 40.0 offset_bottom = 40.0 texture = ExtResource("1_qhv2u") -[node name="HealthBar" type="TextureProgressBar" parent="MarginContainer/InfoBar/HealthBarUnder"] +[node name="HealthBar" type="TextureProgressBar" parent="HUD/InfoBar/HealthBarUnder"] unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 @@ -58,7 +125,7 @@ grow_vertical = 2 value = 100.0 texture_progress = ExtResource("3_j2uiq") -[node name="HealthLabel" type="Label" parent="MarginContainer/InfoBar/HealthBarUnder/HealthBar"] +[node name="HealthLabel" type="Label" parent="HUD/InfoBar/HealthBarUnder/HealthBar"] unique_name_in_owner = true custom_minimum_size = Vector2(96, 0) layout_mode = 1 @@ -73,7 +140,7 @@ text = "999" label_settings = SubResource("LabelSettings_xba4v") vertical_alignment = 1 -[node name="XPBar" type="TextureProgressBar" parent="MarginContainer/InfoBar/HealthBarUnder"] +[node name="XPBar" type="TextureProgressBar" parent="HUD/InfoBar/HealthBarUnder"] unique_name_in_owner = true layout_mode = 1 anchors_preset = 15 @@ -83,13 +150,13 @@ grow_horizontal = 2 grow_vertical = 2 texture_progress = ExtResource("4_ma5hf") -[node name="HealthBarOver" type="TextureRect" parent="MarginContainer/InfoBar"] +[node name="HealthBarOver" type="TextureRect" parent="HUD/InfoBar"] layout_mode = 0 offset_right = 40.0 offset_bottom = 40.0 texture = ExtResource("2_nxqqf") -[node name="LevelLabel" type="Label" parent="MarginContainer/InfoBar/HealthBarOver"] +[node name="LevelLabel" type="Label" parent="HUD/InfoBar/HealthBarOver"] unique_name_in_owner = true custom_minimum_size = Vector2(96, 0) layout_mode = 1 @@ -103,6 +170,28 @@ label_settings = SubResource("LabelSettings_xba4v") horizontal_alignment = 1 vertical_alignment = 1 +[node name="InteractContainer" type="VBoxContainer" parent="HUD"] +visible = false +modulate = Color(1, 1, 1, 0) +custom_minimum_size = Vector2(512, 0) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 8 +mouse_filter = 2 + +[node name="InteractLabel" type="Label" parent="HUD/InteractContainer"] +unique_name_in_owner = true +layout_mode = 2 +text = "Open [E]" +label_settings = SubResource("LabelSettings_g5kcc") +horizontal_alignment = 1 + [node name="Inventory" parent="." instance=ExtResource("7_70hpn")] visible = false layout_mode = 1 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +&"": SubResource("AnimationLibrary_71tnq") +} +autoplay = "RESET" diff --git a/src/scenes/ui/weapon_icon.tscn b/src/scenes/ui/weapon_icon.tscn new file mode 100644 index 0000000..23946c7 --- /dev/null +++ b/src/scenes/ui/weapon_icon.tscn @@ -0,0 +1,15 @@ +[gd_scene load_steps=5 format=3 uid="uid://yyxkltwrme4l"] + +[ext_resource type="PackedScene" uid="uid://b35w0afp1fdpg" path="res://src/scenes/ui/item_icon.tscn" id="1_ubjvp"] +[ext_resource type="Script" uid="uid://sbyl1nlryqxy" path="res://src/scripts/ui/weapon_icon.gd" id="2_v6gmt"] +[ext_resource type="Texture2D" uid="uid://cipdd0pdpdvmr" path="res://assets/ui/icons/sword_icon.png" id="2_yj5kg"] +[ext_resource type="PackedScene" uid="uid://bnkhiay2id2kl" path="res://assets/models/character/gear/longsword.glb" id="3_v6gmt"] + +[node name="WeaponIcon" instance=ExtResource("1_ubjvp")] +script = ExtResource("2_v6gmt") +item_name = "Longsword" +power = 10 +item_model = ExtResource("3_v6gmt") + +[node name="TypeIcon" parent="." index="0"] +texture = ExtResource("2_yj5kg") diff --git a/src/scripts/characters/interaction_cast.gd b/src/scripts/characters/interaction_cast.gd new file mode 100644 index 0000000..dfae05e --- /dev/null +++ b/src/scripts/characters/interaction_cast.gd @@ -0,0 +1,11 @@ +extends ShapeCast3D + +@export var ui: Control + +func check_interactions() -> void: + for collision in get_collision_count(): + var collider = get_collider(collision) + if collider is LootContainer: + ui.update_interact_text("Open [E]") + if Input.is_action_just_pressed("interact"): + print(collider.get_items()) diff --git a/src/scripts/characters/interaction_cast.gd.uid b/src/scripts/characters/interaction_cast.gd.uid new file mode 100644 index 0000000..ad4b56e --- /dev/null +++ b/src/scripts/characters/interaction_cast.gd.uid @@ -0,0 +1 @@ +uid://dn7ggmw2uipln diff --git a/src/scripts/characters/player.gd b/src/scripts/characters/player.gd index cd1fd36..92ece43 100644 --- a/src/scripts/characters/player.gd +++ b/src/scripts/characters/player.gd @@ -25,6 +25,7 @@ var _attack_direction: Vector3 = Vector3.ZERO @onready var collision_shape: CollisionShape3D = $CollisionShape @onready var area_attack: ShapeCast3D = $RigPivot/AreaAttack @onready var ui: Control = $UserInterface +@onready var interaction_cast: ShapeCast3D = $RigPivot/InteractionCast func _ready() -> void: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED @@ -42,6 +43,7 @@ func _physics_process(delta: float) -> void: handle_idle_physics_frame(delta, direction) handle_slashing_physics_frame(delta) handle_overhead_physics_frame() + interaction_cast.check_interactions() # Add the gravity. if not is_on_floor(): diff --git a/src/scripts/structures/chest.gd b/src/scripts/structures/chest.gd new file mode 100644 index 0000000..a7e1740 --- /dev/null +++ b/src/scripts/structures/chest.gd @@ -0,0 +1,5 @@ +class_name LootContainer extends StaticBody3D + +func get_items() -> Array: + return get_children().filter(func(child): return child is ItemIcon) + diff --git a/src/scripts/structures/chest.gd.uid b/src/scripts/structures/chest.gd.uid new file mode 100644 index 0000000..9234161 --- /dev/null +++ b/src/scripts/structures/chest.gd.uid @@ -0,0 +1 @@ +uid://lo6t7u4km0rf diff --git a/src/scripts/ui/armor_icon.gd b/src/scripts/ui/armor_icon.gd new file mode 100644 index 0000000..677a5c7 --- /dev/null +++ b/src/scripts/ui/armor_icon.gd @@ -0,0 +1,11 @@ +class_name ArmorIcon extends ItemIcon + +enum armor_type { IRON_PLATE, STEEL_PLATE } + +@export var power: int +@export var armor: armor_type + +func _ready() -> void: + stat_label.text = "%d" % power + item_name_label.text = armor_type.keys()[armor] + diff --git a/src/scripts/ui/armor_icon.gd.uid b/src/scripts/ui/armor_icon.gd.uid new file mode 100644 index 0000000..0e802e6 --- /dev/null +++ b/src/scripts/ui/armor_icon.gd.uid @@ -0,0 +1 @@ +uid://dccbhlja0hs4f diff --git a/src/scripts/ui/currency_icon.gd b/src/scripts/ui/currency_icon.gd new file mode 100644 index 0000000..deb8f78 --- /dev/null +++ b/src/scripts/ui/currency_icon.gd @@ -0,0 +1,6 @@ +class_name CurrencyIcon extends ItemIcon + +@export var value: int + +func _ready() -> void: + stat_label.text = "%d" % value diff --git a/src/scripts/ui/currency_icon.gd.uid b/src/scripts/ui/currency_icon.gd.uid new file mode 100644 index 0000000..6bcb6e4 --- /dev/null +++ b/src/scripts/ui/currency_icon.gd.uid @@ -0,0 +1 @@ +uid://wfl5wn2etfof diff --git a/src/scripts/ui/item_icon.gd b/src/scripts/ui/item_icon.gd new file mode 100644 index 0000000..b5f59cb --- /dev/null +++ b/src/scripts/ui/item_icon.gd @@ -0,0 +1,11 @@ +class_name ItemIcon extends TextureButton + +signal interact(item) + +@onready var stat_label: Label = $MarginContainer/StatLabel +@onready var item_name_label: Label = $MarginContainer/ItemNameLabel + +func _on_gui_input(event: InputEvent) -> void: + if event.is_action("click"): + interact.emit(self) + diff --git a/src/scripts/ui/item_icon.gd.uid b/src/scripts/ui/item_icon.gd.uid new file mode 100644 index 0000000..538843d --- /dev/null +++ b/src/scripts/ui/item_icon.gd.uid @@ -0,0 +1 @@ +uid://caylfrnj8yf8d diff --git a/src/scripts/ui/shield_icon.gd b/src/scripts/ui/shield_icon.gd new file mode 100644 index 0000000..2e6f0aa --- /dev/null +++ b/src/scripts/ui/shield_icon.gd @@ -0,0 +1,9 @@ +class_name ShieldIcon extends ItemIcon + +@export var item_name: String +@export var protection: int +@export var item_model: PackedScene + +func _ready() -> void: + stat_label.text = "+%d" % protection + item_name_label.text = item_name diff --git a/src/scripts/ui/shield_icon.gd.uid b/src/scripts/ui/shield_icon.gd.uid new file mode 100644 index 0000000..60be799 --- /dev/null +++ b/src/scripts/ui/shield_icon.gd.uid @@ -0,0 +1 @@ +uid://bksew7p0rbve6 diff --git a/src/scripts/ui/user_interface.gd b/src/scripts/ui/user_interface.gd index 6208e18..caf445a 100644 --- a/src/scripts/ui/user_interface.gd +++ b/src/scripts/ui/user_interface.gd @@ -5,6 +5,8 @@ extends Control @onready var xp_bar: TextureProgressBar = %XPBar @onready var health_label: Label = %HealthLabel @onready var inventory: Control = $Inventory +@onready var animation_player: AnimationPlayer = $AnimationPlayer +@onready var interact_label: Label = %InteractLabel @export var player: Player @@ -31,3 +33,9 @@ func toggle_inventory_menu() -> void: Input.mouse_mode = Input.MOUSE_MODE_VISIBLE else: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + +func update_interact_text(text: String) -> void: + animation_player.stop() + animation_player.play("fade_out_text") + interact_label.text = text + diff --git a/src/scripts/ui/weapon_icon.gd b/src/scripts/ui/weapon_icon.gd new file mode 100644 index 0000000..be66792 --- /dev/null +++ b/src/scripts/ui/weapon_icon.gd @@ -0,0 +1,9 @@ +class_name WeaponIcon extends ItemIcon + +@export var item_name: String +@export var power: int +@export var item_model: PackedScene + +func _ready() -> void: + stat_label.text = "+%d" % power + item_name_label.text = item_name diff --git a/src/scripts/ui/weapon_icon.gd.uid b/src/scripts/ui/weapon_icon.gd.uid new file mode 100644 index 0000000..288d3d0 --- /dev/null +++ b/src/scripts/ui/weapon_icon.gd.uid @@ -0,0 +1 @@ +uid://sbyl1nlryqxy