Add EnemyControllerComponent and PeriodicShootingComponent; implement enemy shooting behavior and bullet spawning
This commit is contained in:
@@ -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)
|
||||
|
@@ -1,33 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dfwpha0d18dmn"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_rwgpm"]
|
||||
[ext_resource type="Script" uid="uid://2i7p7v135u7c" path="res://scripts/components/DamageComponent.cs" id="2_hrj61"]
|
||||
[ext_resource type="Script" uid="uid://df1llrbm80e02" path="res://scripts/components/BeamComponent.cs" id="3_hrj61"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ptfn7"]
|
||||
size = Vector2(8, 16)
|
||||
|
||||
[node name="Cannon Ray" type="Area2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 5
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_repeat = 2
|
||||
texture = ExtResource("1_rwgpm")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(176, 64, 16, 16)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_ptfn7")
|
||||
|
||||
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area")]
|
||||
script = ExtResource("2_hrj61")
|
||||
Area = NodePath("..")
|
||||
|
||||
[node name="BeamComponent" type="Node2D" parent="." node_paths=PackedStringArray("Root", "Sprite", "CollisionShape")]
|
||||
position = Vector2(0, -8)
|
||||
script = ExtResource("3_hrj61")
|
||||
ExpansionSpeed = 16.0
|
||||
Root = NodePath(".")
|
||||
Sprite = NodePath("../Sprite2D")
|
||||
CollisionShape = NodePath("../CollisionShape2D")
|
@@ -1,35 +0,0 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://d3lt4rhxduv44"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_l5x2w"]
|
||||
[ext_resource type="Script" uid="uid://2i7p7v135u7c" path="res://scripts/components/DamageComponent.cs" id="2_0kbpg"]
|
||||
[ext_resource type="Script" uid="uid://df1llrbm80e02" path="res://scripts/components/BeamComponent.cs" id="3_0kbpg"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ptfn7"]
|
||||
size = Vector2(16, 8)
|
||||
|
||||
[node name="Cannon Ray" type="Area2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 5
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_repeat = 2
|
||||
rotation = 1.5708
|
||||
texture = ExtResource("1_l5x2w")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(176, 64, 16, 16)
|
||||
region_filter_clip_enabled = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_ptfn7")
|
||||
|
||||
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area")]
|
||||
script = ExtResource("2_0kbpg")
|
||||
Area = NodePath("..")
|
||||
|
||||
[node name="BeamComponent" type="Node2D" parent="." node_paths=PackedStringArray("Root", "Sprite", "CollisionShape")]
|
||||
position = Vector2(8, 0)
|
||||
script = ExtResource("3_0kbpg")
|
||||
ExpansionSpeed = 16.0
|
||||
Root = NodePath("..")
|
||||
Sprite = NodePath("../Sprite2D")
|
||||
CollisionShape = NodePath("../CollisionShape2D")
|
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=28 format=3 uid="uid://bwdlmualj6xbw"]
|
||||
[gd_scene load_steps=29 format=3 uid="uid://bwdlmualj6xbw"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="1_ep4yr"]
|
||||
[ext_resource type="Texture2D" uid="uid://cu72810eyk4dx" path="res://sprites/enemy-robot.png" id="2_hjtwe"]
|
||||
@@ -19,6 +19,7 @@
|
||||
[ext_resource type="PackedScene" uid="uid://ck6nml06tm6ue" path="res://objects/fxs/ice_fx.tscn" id="16_68hnm"]
|
||||
[ext_resource type="PackedScene" uid="uid://b12tppjkkqpt4" path="res://objects/fxs/hit_particles.tscn" id="18_pxaaa"]
|
||||
[ext_resource type="Script" uid="uid://cgfynrn68lp12" path="res://scripts/components/KnockbackComponent.cs" id="19_xku20"]
|
||||
[ext_resource type="Script" uid="uid://bhbgjr8ty2n85" path="res://scripts/components/EnemyControllerComponent.cs" id="20_5lji2"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
|
||||
size = Vector2(25, 31)
|
||||
@@ -97,13 +98,12 @@ RightRay = NodePath("../Right Ray")
|
||||
LeftWallRay = NodePath("../Left Wall Ray")
|
||||
RightWallRay = NodePath("../Right Wall Ray")
|
||||
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("SideToSideMovement", "BulletSpawnRight", "BulletSpawnLeft")]
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("BulletSpawnPointRight", "BulletSpawnPointLeft")]
|
||||
script = ExtResource("6_lgbyy")
|
||||
BulletScene = ExtResource("7_r48kf")
|
||||
SideToSideMovement = NodePath("../SideToSideMovement")
|
||||
BulletSpawnRight = NodePath("../Sprite2D/right bullet spawn")
|
||||
BulletSpawnLeft = NodePath("../Sprite2D/left bullet spawn")
|
||||
ShootingIntervalVariation = 0.1
|
||||
BulletSpawnPointRight = NodePath("../Sprite2D/right bullet spawn")
|
||||
BulletSpawnPointLeft = NodePath("../Sprite2D/left bullet spawn")
|
||||
ShootingIntervalVariation = 0.3
|
||||
|
||||
[node name="EnemyDeathComponent" type="Node" parent="." node_paths=PackedStringArray("CollisionShape", "Health")]
|
||||
script = ExtResource("8_pxaaa")
|
||||
@@ -187,3 +187,9 @@ process_material = SubResource("ParticleProcessMaterial_pxaaa")
|
||||
[node name="KnockbackComponent" type="Node" parent="."]
|
||||
script = ExtResource("19_xku20")
|
||||
metadata/_custom_type_script = "uid://cgfynrn68lp12"
|
||||
|
||||
[node name="EnemyControllerComponent" type="Node" parent="." node_paths=PackedStringArray("MovementComponent", "ShootingComponent")]
|
||||
script = ExtResource("20_5lji2")
|
||||
MovementComponent = NodePath("../SideToSideMovement")
|
||||
ShootingComponent = NodePath("../PeriodicShootingComponent")
|
||||
metadata/_custom_type_script = "uid://bhbgjr8ty2n85"
|
||||
|
Reference in New Issue
Block a user