Refactor enemy and shooting components to improve bullet spawn logic and adjust enemy size
This commit is contained in:
42
objects/bg.tscn
Normal file
42
objects/bg.tscn
Normal file
@@ -0,0 +1,42 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dtjrpkhssq32a"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://t7mulx3226o0" path="res://sprites/backgrounds/Background_2.png" id="1_w23vv"]
|
||||
[ext_resource type="Texture2D" uid="uid://c7i1ariim7idx" path="res://sprites/backgrounds/Background_1.png" id="2_pm10e"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnsghs5y3pw5s" path="res://sprites/backgrounds/8.png" id="3_cvs3x"]
|
||||
[ext_resource type="Texture2D" uid="uid://tk2bj7w1jxgj" path="res://sprites/backgrounds/background1.png" id="4_4j3tt"]
|
||||
[ext_resource type="Texture2D" uid="uid://dwxbabw207t3r" path="res://sprites/backgrounds/background2.png" id="5_mgjfj"]
|
||||
[ext_resource type="Texture2D" uid="uid://j0d5cqrrftjj" path="res://sprites/backgrounds/background3.png" id="6_le8kl"]
|
||||
[ext_resource type="Texture2D" uid="uid://cj2yaw03r4q82" path="res://sprites/backgrounds/background4a.png" id="7_nkaxn"]
|
||||
|
||||
[node name="BG" type="Node2D"]
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_w23vv")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("2_pm10e")
|
||||
|
||||
[node name="8" type="Sprite2D" parent="."]
|
||||
position = Vector2(-30, -25)
|
||||
texture = ExtResource("3_cvs3x")
|
||||
|
||||
[node name="Background1" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(14, 335)
|
||||
texture = ExtResource("4_4j3tt")
|
||||
|
||||
[node name="Background2" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(14, 335)
|
||||
texture = ExtResource("5_mgjfj")
|
||||
|
||||
[node name="Background3" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(10, 355)
|
||||
texture = ExtResource("6_le8kl")
|
||||
|
||||
[node name="Background4a" type="Sprite2D" parent="."]
|
||||
visible = false
|
||||
position = Vector2(10, 355)
|
||||
texture = ExtResource("7_nkaxn")
|
@@ -21,7 +21,6 @@ shape = SubResource("RectangleShape2D_dj5g5")
|
||||
[node name="Root" type="Node2D" parent="."]
|
||||
|
||||
[node name="Body" type="Node2D" parent="Root"]
|
||||
scale = Vector2(0.5, 0.5)
|
||||
|
||||
[node name="Base" type="Sprite2D" parent="Root/Body"]
|
||||
texture = ExtResource("1_jcisc")
|
||||
@@ -37,7 +36,7 @@ texture = ExtResource("3_k41y7")
|
||||
hframes = 2
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Root"]
|
||||
position = Vector2(6, 1)
|
||||
position = Vector2(3, 1)
|
||||
rotation = 0.785398
|
||||
texture = ExtResource("4_vq1oq")
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=18 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://xes6mt2dd5gu" path="res://sprites/robot_cutout.png" id="1_uh38l"]
|
||||
[ext_resource type="Texture2D" uid="uid://cu72810eyk4dx" path="res://sprites/enemy-robot.png" id="2_hjtwe"]
|
||||
[ext_resource type="Script" path="res://scripts/components/health.gd" id="2_o170m"]
|
||||
[ext_resource type="Script" path="res://scripts/components/damage_component.gd" id="4_4eajk"]
|
||||
[ext_resource type="Script" path="res://scripts/components/side_to_side_movement.gd" id="4_gbsq8"]
|
||||
@@ -16,7 +16,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://dyev46uqusimi" path="res://sfx/shoot.wav" id="14_tdjks"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pwwji"]
|
||||
size = Vector2(18, 27)
|
||||
size = Vector2(25, 31)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_j18j0"]
|
||||
shader = ExtResource("1_ep4yr")
|
||||
@@ -24,18 +24,24 @@ shader_parameter/enabled = false
|
||||
shader_parameter/tint = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ejbqt"]
|
||||
size = Vector2(18, 27)
|
||||
size = Vector2(25, 31)
|
||||
|
||||
[node name="Enemy" type="CharacterBody2D"]
|
||||
collision_layer = 8
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, 0.5)
|
||||
position = Vector2(-1.5, 0.5)
|
||||
shape = SubResource("RectangleShape2D_pwwji")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_j18j0")
|
||||
texture = ExtResource("1_uh38l")
|
||||
texture = ExtResource("2_hjtwe")
|
||||
|
||||
[node name="right bullet spawn" type="Node2D" parent="Sprite2D"]
|
||||
position = Vector2(16, 7)
|
||||
|
||||
[node name="left bullet spawn" type="Node2D" parent="Sprite2D"]
|
||||
position = Vector2(-17, 7)
|
||||
|
||||
[node name="HealthComponent" type="Node" parent="." node_paths=PackedStringArray("hurt_fx")]
|
||||
script = ExtResource("2_o170m")
|
||||
@@ -54,11 +60,13 @@ wait_time = 0.5
|
||||
left_ray = NodePath("../Left Ray")
|
||||
right_ray = NodePath("../Right Ray")
|
||||
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("side_to_side_movement", "root")]
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("side_to_side_movement", "root", "bullet_spawn_right", "bullet_spawn_left")]
|
||||
process_mode = 3
|
||||
script = ExtResource("5_m03v0")
|
||||
side_to_side_movement = NodePath("../SideToSideMovement")
|
||||
root = NodePath("..")
|
||||
bullet_spawn_right = NodePath("../Sprite2D/right bullet spawn")
|
||||
bullet_spawn_left = NodePath("../Sprite2D/left bullet spawn")
|
||||
|
||||
[node name="EnemyDeathComponent" type="Node" parent="." node_paths=PackedStringArray("root", "collision_shape_2d", "health_component")]
|
||||
script = ExtResource("6_6p3gr")
|
||||
@@ -72,7 +80,7 @@ collision_layer = 8
|
||||
collision_mask = 20
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
|
||||
position = Vector2(0, 0.5)
|
||||
position = Vector2(-1.5, 0.5)
|
||||
shape = SubResource("RectangleShape2D_ejbqt")
|
||||
debug_color = Color(0.913521, 0.265052, 0.323172, 0.42)
|
||||
|
||||
|
Reference in New Issue
Block a user