diff --git a/client/enemy/slime/Slime.tscn b/client/enemy/slime/Slime.tscn index 4258fef..1f910af 100644 --- a/client/enemy/slime/Slime.tscn +++ b/client/enemy/slime/Slime.tscn @@ -61,5 +61,6 @@ libraries = { autoplay = "slime_idle" [node name="Health" parent="." instance=ExtResource("2_fsqxc")] +max_value = 100.0 [node name="Movement" parent="." instance=ExtResource("3_2phqx")] diff --git a/client/player/Player.tscn b/client/player/Player.tscn index 70df7ba..4f64588 100644 --- a/client/player/Player.tscn +++ b/client/player/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://2lcnu3dy54lx"] +[gd_scene load_steps=17 format=3 uid="uid://2lcnu3dy54lx"] [ext_resource type="Script" path="res://player/Player.gd" id="1_8gebs"] [ext_resource type="PackedScene" uid="uid://c8j7t4yg7anb0" path="res://assets/female/Female.blend" id="2_8nah6"] @@ -13,11 +13,15 @@ [ext_resource type="PackedScene" uid="uid://bivxnxwi863o0" path="res://player/animation/AnimationComponent.tscn" id="10_bcaeg"] [ext_resource type="AnimationLibrary" uid="uid://d4n0puibh4hyt" path="res://assets/animations/human.blend" id="11_d0e6r"] [ext_resource type="PackedScene" uid="uid://b8xf4ltqyorjv" path="res://player/skills/SkillsComponent.tscn" id="14_6idcf"] +[ext_resource type="Script" path="res://player/skills/MeleeArea.gd" id="14_g0mpw"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2f50n"] radius = 0.3 height = 1.6 +[sub_resource type="CylinderShape3D" id="CylinderShape3D_4r7eu"] +radius = 2.0 + [node name="Player" type="CharacterBody3D" groups=["player"]] collision_layer = 512 collision_mask = 769 @@ -74,13 +78,12 @@ strength = 15.0 radius = 2.0 [node name="Health" parent="." instance=ExtResource("2_np5ag")] -unique_name_in_owner = true max_value = 100.0 [node name="Movement" parent="." instance=ExtResource("8_25qd0")] [node name="Rotation" parent="." node_paths=PackedStringArray("root") instance=ExtResource("9_agxqu")] -root = NodePath("../Model") +root = NodePath("..") [node name="Animation" parent="." instance=ExtResource("10_bcaeg")] @@ -92,5 +95,19 @@ libraries = { [node name="Skills" parent="." instance=ExtResource("14_6idcf")] +[node name="MeleeArea" type="Area3D" parent="."] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 2.32) +collision_layer = 0 +collision_mask = 256 +monitoring = false +monitorable = false +script = ExtResource("14_g0mpw") + +[node name="CylinderShape" type="CollisionShape3D" parent="MeleeArea"] +shape = SubResource("CylinderShape3D_4r7eu") + +[connection signal="body_entered" from="MeleeArea" to="MeleeArea" method="on_body_entered"] + [editable path="Model/Female"] [editable path="Animation"] diff --git a/client/player/skills/MeleeArea.gd b/client/player/skills/MeleeArea.gd new file mode 100644 index 0000000..362dffe --- /dev/null +++ b/client/player/skills/MeleeArea.gd @@ -0,0 +1,7 @@ +extends Area3D + +func on_body_entered(body: Node3D): + var health := body.get_node_or_null("Health") as HealthComponent + + if health: + health.take_damage(DamageInstance.new(10)) \ No newline at end of file diff --git a/client/player/skills/SkillsComponent.gd b/client/player/skills/SkillsComponent.gd index 69f032f..d3a7820 100644 --- a/client/player/skills/SkillsComponent.gd +++ b/client/player/skills/SkillsComponent.gd @@ -8,4 +8,8 @@ func _ready(): player.attacked.connect(attack) func attack(): - %Health.take_damage(DamageInstance.new(10)) + var area := %MeleeArea as Area3D + await get_tree().create_timer(0.5).timeout + area.monitoring = true + await get_tree().create_timer(0.1).timeout + area.monitoring = false