Add KnockbackComponent and HazardComponent for enhanced enemy interactions; integrate knockback effects in DamageComponent

This commit is contained in:
2025-09-11 05:09:24 +02:00
parent 98b3202361
commit aa73e54b3e
10 changed files with 127 additions and 50 deletions

View File

@@ -0,0 +1,41 @@
[gd_scene load_steps=6 format=3 uid="uid://un55bdc2cg2q"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1nndd"]
[ext_resource type="Script" uid="uid://cgfynrn68lp12" path="res://scripts/components/KnockbackComponent.cs" id="2_bljtt"]
[ext_resource type="Script" uid="uid://nhu2xd8611fk" path="res://scripts/components/HazardComponent.cs" id="3_bljtt"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_14ml2"]
size = Vector2(14, 15)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4q8oh"]
size = Vector2(16, 16)
[node name="Cactus" type="StaticBody2D"]
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 0.5)
shape = SubResource("RectangleShape2D_14ml2")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_1nndd")
hframes = 12
vframes = 12
frame = 71
[node name="Area2D" type="Area2D" parent="."]
collision_mask = 12
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(-0.5, 0)
shape = SubResource("RectangleShape2D_4q8oh")
debug_color = Color(0.285572, 0.422655, 0.118384, 0.42)
[node name="KnockbackComponent" type="Node" parent="."]
script = ExtResource("2_bljtt")
metadata/_custom_type_script = "uid://cgfynrn68lp12"
[node name="HazardComponent" type="Node2D" parent="." node_paths=PackedStringArray("KnockbackComponent", "HazardArea")]
script = ExtResource("3_bljtt")
KnockbackComponent = NodePath("../KnockbackComponent")
HazardArea = NodePath("../Area2D")
metadata/_custom_type_script = "uid://nhu2xd8611fk"