feat: add enemy node; add player/enemy collision; add player hp to the scene manager; add hit by enemy logic;

This commit is contained in:
2026-09-20 20:05:22 +02:00
parent a528943b91
commit a252f9419e
7 changed files with 88 additions and 18 deletions
+17 -4
View File
@@ -143,6 +143,9 @@ animations = [{
radius = 5.0
height = 10.0
[sub_resource type="CircleShape2D" id="CircleShape2D_chgu2"]
radius = 4.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_chgu2"]
size = Vector2(8, 8)
@@ -162,10 +165,19 @@ animation = &"move_down"
position = Vector2(0, 3)
shape = SubResource("CapsuleShape2D_bqpwv")
[node name="Area2D" type="Area2D" parent="." unique_id=145023444]
[node name="HitBoxArea2D" type="Area2D" parent="." unique_id=1052547818]
collision_layer = 2
collision_mask = 16
[node name="CollisionShape2D" type="CollisionShape2D" parent="HitBoxArea2D" unique_id=206980179]
position = Vector2(0, 2)
shape = SubResource("CircleShape2D_chgu2")
debug_color = Color(0.99152297, 0, 0.27048782, 0.41960785)
[node name="InteractArea2D" type="Area2D" parent="." unique_id=145023444]
collision_layer = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=775673729]
[node name="CollisionShape2D" type="CollisionShape2D" parent="InteractArea2D" unique_id=775673729]
shape = SubResource("RectangleShape2D_chgu2")
debug_color = Color(0.9427947, 0.09120729, 0.5535774, 0.41960785)
@@ -194,5 +206,6 @@ offset_right = 63.0
offset_bottom = 62.0
texture = ExtResource("3_xpcdj")
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]
[connection signal="body_entered" from="HitBoxArea2D" to="." method="_on_hit_box_area_2d_body_entered"]
[connection signal="body_entered" from="InteractArea2D" to="." method="_on_area_2d_body_entered"]
[connection signal="body_exited" from="InteractArea2D" to="." method="_on_area_2d_body_exited"]