Add FallOnDetectionComponent and CleanupOnCollisionComponent; implement falling detection and cleanup on collision
This commit is contained in:
@@ -15,7 +15,7 @@ radius = 4.0
|
||||
|
||||
[node name="Bullet" type="Area2D"]
|
||||
collision_layer = 64
|
||||
collision_mask = 21
|
||||
collision_mask = 85
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_txsw8")
|
||||
@@ -47,7 +47,7 @@ VisibilityNotifier = NodePath("../VisibleOnScreenNotifier2D")
|
||||
|
||||
[node name="LifetimeComponent" type="Node" parent="."]
|
||||
script = ExtResource("4_aniyw")
|
||||
LifeTime = 10.0
|
||||
LifeTime = 3.0
|
||||
|
||||
[node name="LaunchComponent" type="Node2D" parent="."]
|
||||
script = ExtResource("5_3ks47")
|
||||
|
||||
48
objects/entities/cannon_down.tscn
Normal file
48
objects/entities/cannon_down.tscn
Normal file
@@ -0,0 +1,48 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://qrbiu1qo4tt5"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_0efvn"]
|
||||
[ext_resource type="Script" uid="uid://bnaxy8cw3wrko" path="res://scripts/components/PeriodicShootingComponent.cs" id="2_4ycs1"]
|
||||
[ext_resource type="PackedScene" uid="uid://chetx6gmnwbxi" path="res://objects/entities/cannon_bullet.tscn" id="3_ab2uh"]
|
||||
[ext_resource type="Script" uid="uid://b3j23e7b7x8ro" path="res://scripts/components/RecoilComponent.cs" id="4_tynaf"]
|
||||
[ext_resource type="Script" uid="uid://c707c53k7c5ae" path="res://scripts/components/SquashAndStretchComponent.cs" id="5_0xigu"]
|
||||
|
||||
[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="."]
|
||||
rotation = 3.14159
|
||||
texture = ExtResource("1_0efvn")
|
||||
hframes = 12
|
||||
vframes = 12
|
||||
frame = 42
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_j5sus")
|
||||
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("BulletSpawnPointRight")]
|
||||
script = ExtResource("2_4ycs1")
|
||||
BulletScene = ExtResource("3_ab2uh")
|
||||
ShootInterval = 3.0
|
||||
ShootDirection = Vector2(0, 1)
|
||||
BulletSpawnPointRight = NodePath("../Bullet spawn")
|
||||
ShootingIntervalVariation = 0.61
|
||||
metadata/_custom_type_script = "uid://bnaxy8cw3wrko"
|
||||
|
||||
[node name="Bullet spawn" type="Marker2D" parent="."]
|
||||
position = Vector2(0, 12)
|
||||
|
||||
[node name="RecoilComponent" type="Node" parent="." node_paths=PackedStringArray("RecoilTarget")]
|
||||
script = ExtResource("4_tynaf")
|
||||
RecoilTarget = NodePath("../Sprite2D")
|
||||
RecoilDistance = 4.0
|
||||
RecoilDuration = 0.12
|
||||
metadata/_custom_type_script = "uid://b3j23e7b7x8ro"
|
||||
|
||||
[node name="SquashAndStretchComponent" type="Node" parent="." node_paths=PackedStringArray("TargetNode")]
|
||||
script = ExtResource("5_0xigu")
|
||||
TargetNode = NodePath("../Sprite2D")
|
||||
metadata/_custom_type_script = "uid://c707c53k7c5ae"
|
||||
48
objects/entities/cannon_left.tscn
Normal file
48
objects/entities/cannon_left.tscn
Normal file
@@ -0,0 +1,48 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://cm0rd70wafif1"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_hnnrt"]
|
||||
[ext_resource type="Script" uid="uid://bnaxy8cw3wrko" path="res://scripts/components/PeriodicShootingComponent.cs" id="2_cho7n"]
|
||||
[ext_resource type="PackedScene" uid="uid://chetx6gmnwbxi" path="res://objects/entities/cannon_bullet.tscn" id="3_kgmtj"]
|
||||
[ext_resource type="Script" uid="uid://b3j23e7b7x8ro" path="res://scripts/components/RecoilComponent.cs" id="4_nfk87"]
|
||||
[ext_resource type="Script" uid="uid://c707c53k7c5ae" path="res://scripts/components/SquashAndStretchComponent.cs" id="5_43fqe"]
|
||||
|
||||
[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="."]
|
||||
rotation = -1.5708
|
||||
texture = ExtResource("1_hnnrt")
|
||||
hframes = 12
|
||||
vframes = 12
|
||||
frame = 42
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_j5sus")
|
||||
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("BulletSpawnPointRight")]
|
||||
script = ExtResource("2_cho7n")
|
||||
BulletScene = ExtResource("3_kgmtj")
|
||||
ShootInterval = 3.0
|
||||
ShootDirection = Vector2(-1, 0)
|
||||
BulletSpawnPointRight = NodePath("../Bullet spawn")
|
||||
ShootingIntervalVariation = 0.61
|
||||
metadata/_custom_type_script = "uid://bnaxy8cw3wrko"
|
||||
|
||||
[node name="Bullet spawn" type="Marker2D" parent="."]
|
||||
position = Vector2(-12, 0)
|
||||
|
||||
[node name="RecoilComponent" type="Node" parent="." node_paths=PackedStringArray("RecoilTarget")]
|
||||
script = ExtResource("4_nfk87")
|
||||
RecoilTarget = NodePath("../Sprite2D")
|
||||
RecoilDistance = 4.0
|
||||
RecoilDuration = 0.12
|
||||
metadata/_custom_type_script = "uid://b3j23e7b7x8ro"
|
||||
|
||||
[node name="SquashAndStretchComponent" type="Node" parent="." node_paths=PackedStringArray("TargetNode")]
|
||||
script = ExtResource("5_43fqe")
|
||||
TargetNode = NodePath("../Sprite2D")
|
||||
metadata/_custom_type_script = "uid://c707c53k7c5ae"
|
||||
47
objects/entities/cannon_right.tscn
Normal file
47
objects/entities/cannon_right.tscn
Normal file
@@ -0,0 +1,47 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dr6srln4mckwn"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_r5bjs"]
|
||||
[ext_resource type="Script" uid="uid://bnaxy8cw3wrko" path="res://scripts/components/PeriodicShootingComponent.cs" id="2_gd3be"]
|
||||
[ext_resource type="PackedScene" uid="uid://chetx6gmnwbxi" path="res://objects/entities/cannon_bullet.tscn" id="3_1gufj"]
|
||||
[ext_resource type="Script" uid="uid://b3j23e7b7x8ro" path="res://scripts/components/RecoilComponent.cs" id="4_hwc6x"]
|
||||
[ext_resource type="Script" uid="uid://c707c53k7c5ae" path="res://scripts/components/SquashAndStretchComponent.cs" id="5_o674s"]
|
||||
|
||||
[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="."]
|
||||
rotation = 1.5708
|
||||
texture = ExtResource("1_r5bjs")
|
||||
hframes = 12
|
||||
vframes = 12
|
||||
frame = 42
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_j5sus")
|
||||
|
||||
[node name="PeriodicShootingComponent" type="Node" parent="." node_paths=PackedStringArray("BulletSpawnPointRight")]
|
||||
script = ExtResource("2_gd3be")
|
||||
BulletScene = ExtResource("3_1gufj")
|
||||
ShootInterval = 3.0
|
||||
BulletSpawnPointRight = NodePath("../Bullet spawn")
|
||||
ShootingIntervalVariation = 0.61
|
||||
metadata/_custom_type_script = "uid://bnaxy8cw3wrko"
|
||||
|
||||
[node name="Bullet spawn" type="Marker2D" parent="."]
|
||||
position = Vector2(12, 0)
|
||||
|
||||
[node name="RecoilComponent" type="Node" parent="." node_paths=PackedStringArray("RecoilTarget")]
|
||||
script = ExtResource("4_hwc6x")
|
||||
RecoilTarget = NodePath("../Sprite2D")
|
||||
RecoilDistance = 4.0
|
||||
RecoilDuration = 0.12
|
||||
metadata/_custom_type_script = "uid://b3j23e7b7x8ro"
|
||||
|
||||
[node name="SquashAndStretchComponent" type="Node" parent="." node_paths=PackedStringArray("TargetNode")]
|
||||
script = ExtResource("5_o674s")
|
||||
TargetNode = NodePath("../Sprite2D")
|
||||
metadata/_custom_type_script = "uid://c707c53k7c5ae"
|
||||
78
objects/entities/falling_spike.tscn
Normal file
78
objects/entities/falling_spike.tscn
Normal file
@@ -0,0 +1,78 @@
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bmk3ddwv33dud"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ccjihsk6w8sow" path="res://sprites/BFT - Mega Metroidvania Tileset.png" id="1_erbp6"]
|
||||
[ext_resource type="Script" uid="uid://2i7p7v135u7c" path="res://scripts/components/DamageComponent.cs" id="2_fq2gn"]
|
||||
[ext_resource type="Script" uid="uid://v7tt4w6bejux" path="res://scripts/components/CleanupComponent.cs" id="4_mgh1e"]
|
||||
[ext_resource type="Script" uid="uid://nhu2xd8611fk" path="res://scripts/components/HazardComponent.cs" id="5_8g254"]
|
||||
[ext_resource type="Script" uid="uid://chusyr5vwgwf0" path="res://scripts/components/CleanupOnCollisionComponent.cs" id="6_2rpon"]
|
||||
[ext_resource type="Script" uid="uid://cgfynrn68lp12" path="res://scripts/components/KnockbackComponent.cs" id="6_3n0l8"]
|
||||
[ext_resource type="Script" uid="uid://co05ugnvx0v3e" path="res://scripts/components/FallOnDetectionComponent.cs" id="7_mgh1e"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_t3a48"]
|
||||
size = Vector2(16, 8)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fq2gn"]
|
||||
size = Vector2(16, 320)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2rpon"]
|
||||
size = Vector2(17, 9)
|
||||
|
||||
[node name="FallingSpike" type="RigidBody2D"]
|
||||
collision_mask = 5
|
||||
gravity_scale = 0.0
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(0, -4)
|
||||
shape = SubResource("RectangleShape2D_t3a48")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
rotation = -3.14159
|
||||
texture = ExtResource("1_erbp6")
|
||||
hframes = 13
|
||||
vframes = 45
|
||||
frame = 9
|
||||
|
||||
[node name="DamageComponent" type="Node" parent="." node_paths=PackedStringArray("Area")]
|
||||
script = ExtResource("2_fq2gn")
|
||||
Area = NodePath("")
|
||||
metadata/_custom_type_script = "uid://2i7p7v135u7c"
|
||||
|
||||
[node name="HazardComponent" type="Node2D" parent="." node_paths=PackedStringArray("KnockbackComponent", "HazardArea")]
|
||||
script = ExtResource("5_8g254")
|
||||
KnockbackComponent = NodePath("../KnockbackComponent")
|
||||
HazardArea = NodePath("../HazardArea")
|
||||
metadata/_custom_type_script = "uid://nhu2xd8611fk"
|
||||
|
||||
[node name="KnockbackComponent" type="Node" parent="."]
|
||||
script = ExtResource("6_3n0l8")
|
||||
metadata/_custom_type_script = "uid://cgfynrn68lp12"
|
||||
|
||||
[node name="FallTriggerArea" type="Area2D" parent="."]
|
||||
collision_mask = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="FallTriggerArea"]
|
||||
position = Vector2(0, 155)
|
||||
shape = SubResource("RectangleShape2D_fq2gn")
|
||||
debug_color = Color(0.916282, 7.47952e-05, 0.709809, 0.42)
|
||||
|
||||
[node name="CleanupComponent" type="Node" parent="."]
|
||||
script = ExtResource("4_mgh1e")
|
||||
metadata/_custom_type_script = "uid://v7tt4w6bejux"
|
||||
|
||||
[node name="CleanupOnCollisionComponent" type="Node" parent="."]
|
||||
script = ExtResource("6_2rpon")
|
||||
metadata/_custom_type_script = "uid://chusyr5vwgwf0"
|
||||
|
||||
[node name="FallOnDetectionComponent" type="Node2D" parent="." node_paths=PackedStringArray("DetectionArea", "TargetBody")]
|
||||
script = ExtResource("7_mgh1e")
|
||||
DetectionArea = NodePath("../FallTriggerArea")
|
||||
TargetBody = NodePath("..")
|
||||
metadata/_custom_type_script = "uid://co05ugnvx0v3e"
|
||||
|
||||
[node name="HazardArea" type="Area2D" parent="."]
|
||||
collision_mask = 4
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="HazardArea"]
|
||||
position = Vector2(0, -4.5)
|
||||
shape = SubResource("RectangleShape2D_2rpon")
|
||||
debug_color = Color(0.73011, 0.468379, 0.188355, 0.42)
|
||||
Reference in New Issue
Block a user