Add EnemyControllerComponent and PeriodicShootingComponent; implement enemy shooting behavior and bullet spawning

This commit is contained in:
2025-09-13 13:53:40 +02:00
parent db2a090acc
commit e6f8989d16
9 changed files with 94 additions and 111 deletions

View File

@@ -1,13 +1,15 @@
[gd_scene load_steps=5 format=3 uid="uid://dstko446qydsc"]
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_6gptm"]
[ext_resource type="Script" uid="uid://ctfrbj52ejay4" path="res://scripts/components/DestroyableComponent.cs" id="2_q37h7"]
[ext_resource type="Script" uid="uid://dgb8bqcri7nsj" path="res://scripts/components/HealthComponent.cs" id="3_bhwy3"]
[ext_resource type="Script" uid="uid://bnaxy8cw3wrko" path="res://scripts/components/PeriodicShootingComponent.cs" id="2_q37h7"]
[ext_resource type="PackedScene" uid="uid://bhc7y4xugu4q7" path="res://objects/entities/bullet.tscn" id="3_bhwy3"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_j5sus"]
size = Vector2(16, 16)
[node name="Cannon" type="StaticBody2D"]
collision_layer = 0
collision_mask = 0
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_6gptm")
@@ -15,12 +17,17 @@ hframes = 12
vframes = 12
frame = 42
[node name="DestroyableComponent" type="Node" parent="." node_paths=PackedStringArray("Health")]
script = ExtResource("2_q37h7")
Health = NodePath("../HealthComponent")
[node name="HealthComponent" type="Node2D" parent="."]
script = ExtResource("3_bhwy3")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_j5sus")
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("BulletSpawnPointRight")]
script = ExtResource("2_q37h7")
BulletScene = ExtResource("3_bhwy3")
ShootInterval = 3.5
ShootDirection = Vector2(0, -1)
BulletSpawnPointRight = NodePath("../Bullet spawn")
ShootingIntervalVariation = 0.3
metadata/_custom_type_script = "uid://bnaxy8cw3wrko"
[node name="Bullet spawn" type="Marker2D" parent="."]
position = Vector2(0, -16)