Add terrain hit effects, progressive damage component, and update collectable signals
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://bymro4t7angv5"]
|
[gd_scene load_steps=10 format=3 uid="uid://bymro4t7angv5"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1c3jb"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_1c3jb"]
|
||||||
[ext_resource type="Script" uid="uid://cdnwrn8v05qhi" path="res://scripts/components/bullet_component.gd" id="2_i6t5k"]
|
[ext_resource type="Script" uid="uid://cdnwrn8v05qhi" path="res://scripts/components/bullet_component.gd" id="2_i6t5k"]
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://bgty7040ams6s" path="res://scripts/components/projectile_init_component.gd" id="5_2vqt8"]
|
[ext_resource type="Script" uid="uid://bgty7040ams6s" path="res://scripts/components/projectile_init_component.gd" id="5_2vqt8"]
|
||||||
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="6_d0tcd"]
|
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="6_d0tcd"]
|
||||||
[ext_resource type="Script" uid="uid://cvcnfrr1udco5" path="res://scripts/components/straight_motion_component.gd" id="7_r41xl"]
|
[ext_resource type="Script" uid="uid://cvcnfrr1udco5" path="res://scripts/components/straight_motion_component.gd" id="7_r41xl"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c1iorglk708g0" path="res://objects/fxs/terrain_hit_fx.tscn" id="8_d0tcd"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ar0xf"]
|
||||||
size = Vector2(16, 10)
|
size = Vector2(16, 10)
|
||||||
@@ -24,10 +25,12 @@ hframes = 12
|
|||||||
vframes = 12
|
vframes = 12
|
||||||
frame = 80
|
frame = 80
|
||||||
|
|
||||||
[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d")]
|
[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d", "hit_terrain_fx", "bullet_sprite")]
|
||||||
script = ExtResource("2_i6t5k")
|
script = ExtResource("2_i6t5k")
|
||||||
root = NodePath("..")
|
root = NodePath("..")
|
||||||
area2d = NodePath("..")
|
area2d = NodePath("..")
|
||||||
|
hit_terrain_fx = NodePath("../TerrainHitFX")
|
||||||
|
bullet_sprite = NodePath("../Sprite2D")
|
||||||
|
|
||||||
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
|
||||||
position = Vector2(0, 2.38419e-07)
|
position = Vector2(0, 2.38419e-07)
|
||||||
@@ -60,3 +63,5 @@ script = ExtResource("7_r41xl")
|
|||||||
root = NodePath("..")
|
root = NodePath("..")
|
||||||
launch_component = NodePath("../LaunchComponent")
|
launch_component = NodePath("../LaunchComponent")
|
||||||
metadata/_custom_type_script = "uid://cvcnfrr1udco5"
|
metadata/_custom_type_script = "uid://cvcnfrr1udco5"
|
||||||
|
|
||||||
|
[node name="TerrainHitFX" parent="." instance=ExtResource("8_d0tcd")]
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
[gd_scene load_steps=47 format=3 uid="uid://bqi5s710xb1ju"]
|
[gd_scene load_steps=48 format=3 uid="uid://bqi5s710xb1ju"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ccuddyoakg04u" path="res://scripts/player.gd" id="1_8j4h4"]
|
[ext_resource type="Script" uid="uid://ccuddyoakg04u" path="res://scripts/player.gd" id="1_8j4h4"]
|
||||||
[ext_resource type="Texture2D" uid="uid://b7gp0gqvkv8j4" path="res://sprites/MrBrick_base.png" id="2_bc55y"]
|
|
||||||
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
|
[ext_resource type="Shader" uid="uid://bs4xvm4qkurpr" path="res://shaders/hit_flash.tres" id="2_lgb3u"]
|
||||||
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
|
[ext_resource type="Texture2D" uid="uid://jl1gwqchhpdc" path="res://sprites/left_eye.png" id="3_2srrh"]
|
||||||
[ext_resource type="Script" uid="uid://b3mrdvre1y567" path="res://scripts/components/ship_movement.gd" id="3_p4n66"]
|
[ext_resource type="Script" uid="uid://b3mrdvre1y567" path="res://scripts/components/ship_movement.gd" id="3_p4n66"]
|
||||||
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
|
[ext_resource type="Texture2D" uid="uid://iiawtnwmeny3" path="res://sprites/right_eye.png" id="4_ccn81"]
|
||||||
[ext_resource type="Script" uid="uid://oxeqvxkgj87j" path="res://scripts/components/flip_player.gd" id="5_geu10"]
|
[ext_resource type="Script" uid="uid://oxeqvxkgj87j" path="res://scripts/components/flip_player.gd" id="5_geu10"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://0l454rfplmqg" path="res://sprites/MrBrick_base-sheet.png" id="5_yysbb"]
|
||||||
[ext_resource type="Script" uid="uid://qeu80jy4vmuf" path="res://scripts/components/score.gd" id="6_fowa2"]
|
[ext_resource type="Script" uid="uid://qeu80jy4vmuf" path="res://scripts/components/score.gd" id="6_fowa2"]
|
||||||
[ext_resource type="Script" uid="uid://btfsq0bvtrx3t" path="res://scripts/components/health.gd" id="7_tqjk8"]
|
[ext_resource type="Script" uid="uid://btfsq0bvtrx3t" path="res://scripts/components/health.gd" id="7_tqjk8"]
|
||||||
[ext_resource type="Script" uid="uid://dkpu3121y88oo" path="res://scripts/components/player_death.gd" id="8_1v23d"]
|
[ext_resource type="Script" uid="uid://dkpu3121y88oo" path="res://scripts/components/player_death.gd" id="8_1v23d"]
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://d1ctdx52gskv1" path="res://scripts/components/ship_shooter.gd" id="34_gwc8i"]
|
[ext_resource type="Script" uid="uid://d1ctdx52gskv1" path="res://scripts/components/ship_shooter.gd" id="34_gwc8i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dtem8jgcyoqar" path="res://objects/entities/green_laser.tscn" id="36_oxudy"]
|
[ext_resource type="PackedScene" uid="uid://dtem8jgcyoqar" path="res://objects/entities/green_laser.tscn" id="36_oxudy"]
|
||||||
[ext_resource type="Script" uid="uid://cfeoalic0mu2j" path="res://scripts/components/kill_player_out_of_screen.gd" id="37_oxudy"]
|
[ext_resource type="Script" uid="uid://cfeoalic0mu2j" path="res://scripts/components/kill_player_out_of_screen.gd" id="37_oxudy"]
|
||||||
|
[ext_resource type="Script" uid="uid://d32kd83lf86iy" path="res://scripts/components/progressive_damage_component.gd" id="38_o1ihh"]
|
||||||
|
|
||||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xoue7"]
|
[sub_resource type="ShaderMaterial" id="ShaderMaterial_xoue7"]
|
||||||
shader = ExtResource("2_lgb3u")
|
shader = ExtResource("2_lgb3u")
|
||||||
@@ -116,7 +117,8 @@ metadata/_custom_type_script = "uid://b3mrdvre1y567"
|
|||||||
|
|
||||||
[node name="Base" type="Sprite2D" parent="Graphics/Root"]
|
[node name="Base" type="Sprite2D" parent="Graphics/Root"]
|
||||||
material = SubResource("ShaderMaterial_xoue7")
|
material = SubResource("ShaderMaterial_xoue7")
|
||||||
texture = ExtResource("2_bc55y")
|
texture = ExtResource("5_yysbb")
|
||||||
|
hframes = 5
|
||||||
|
|
||||||
[node name="Left Eye" type="Sprite2D" parent="Graphics/Root"]
|
[node name="Left Eye" type="Sprite2D" parent="Graphics/Root"]
|
||||||
position = Vector2(-7, -6)
|
position = Vector2(-7, -6)
|
||||||
@@ -277,5 +279,12 @@ script = ExtResource("37_oxudy")
|
|||||||
screen_notifier = NodePath("../VisibleOnScreenNotifier2D")
|
screen_notifier = NodePath("../VisibleOnScreenNotifier2D")
|
||||||
health_component = NodePath("../HealthComponent")
|
health_component = NodePath("../HealthComponent")
|
||||||
|
|
||||||
|
[node name="ProgressiveDamageComponent" type="Node" parent="." node_paths=PackedStringArray("health_component", "sprite", "platform_movement")]
|
||||||
|
script = ExtResource("38_o1ihh")
|
||||||
|
health_component = NodePath("../HealthComponent")
|
||||||
|
sprite = NodePath("../Graphics/Root/Base")
|
||||||
|
platform_movement = NodePath("../Movements/PlatformMovement")
|
||||||
|
jump_reduction_percentage = 0.15
|
||||||
|
|
||||||
[connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"]
|
[connection signal="on_death" from="HealthComponent" to="PlayerDeathComponent" method="_on_health_component_on_death"]
|
||||||
[connection signal="on_health_change" from="HealthComponent" to="KnockbackComponent" method="_on_health_component_on_health_change"]
|
[connection signal="on_health_change" from="HealthComponent" to="KnockbackComponent" method="_on_health_component_on_health_change"]
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=9 format=3 uid="uid://bhc7y4xugu4q7"]
|
[gd_scene load_steps=10 format=3 uid="uid://bhc7y4xugu4q7"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_w543f"]
|
[ext_resource type="Texture2D" uid="uid://djifxc5x0dyrw" path="res://sprites/ppc_tileset.png" id="1_w543f"]
|
||||||
[ext_resource type="Script" uid="uid://dkmxhjtmu5xlb" path="res://scripts/components/damage_component.gd" id="2_ll0xw"]
|
[ext_resource type="Script" uid="uid://dkmxhjtmu5xlb" path="res://scripts/components/damage_component.gd" id="2_ll0xw"]
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://bvsgg8lu0a8m6" path="res://scripts/components/lifetime_component.gd" id="5_qsc5m"]
|
[ext_resource type="Script" uid="uid://bvsgg8lu0a8m6" path="res://scripts/components/lifetime_component.gd" id="5_qsc5m"]
|
||||||
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="6_6th6w"]
|
[ext_resource type="Script" uid="uid://873un8agkyja" path="res://scripts/components/launch_component.gd" id="6_6th6w"]
|
||||||
[ext_resource type="Script" uid="uid://cvcnfrr1udco5" path="res://scripts/components/straight_motion_component.gd" id="7_e0mqp"]
|
[ext_resource type="Script" uid="uid://cvcnfrr1udco5" path="res://scripts/components/straight_motion_component.gd" id="7_e0mqp"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c1iorglk708g0" path="res://objects/fxs/terrain_hit_fx.tscn" id="8_6th6w"]
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_txsw8"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_txsw8"]
|
||||||
radius = 4.0
|
radius = 4.0
|
||||||
@@ -59,8 +60,13 @@ script = ExtResource("7_e0mqp")
|
|||||||
root = NodePath("..")
|
root = NodePath("..")
|
||||||
launch_component = NodePath("../LaunchComponent")
|
launch_component = NodePath("../LaunchComponent")
|
||||||
|
|
||||||
[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d")]
|
[node name="BulletComponent" type="Node" parent="." node_paths=PackedStringArray("root", "area2d", "hit_terrain_fx", "bullet_sprite")]
|
||||||
script = ExtResource("3_keogl")
|
script = ExtResource("3_keogl")
|
||||||
root = NodePath("..")
|
root = NodePath("..")
|
||||||
area2d = NodePath("..")
|
area2d = NodePath("..")
|
||||||
|
hit_terrain_fx = NodePath("../TerrainHitFX")
|
||||||
|
bullet_sprite = NodePath("../Sprite2D")
|
||||||
metadata/_custom_type_script = "uid://cdnwrn8v05qhi"
|
metadata/_custom_type_script = "uid://cdnwrn8v05qhi"
|
||||||
|
|
||||||
|
[node name="TerrainHitFX" parent="." instance=ExtResource("8_6th6w")]
|
||||||
|
z_index = 3
|
||||||
|
32
objects/entities/small_heal_potion.tscn
Normal file
32
objects/entities/small_heal_potion.tscn
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
[gd_scene load_steps=6 format=3 uid="uid://t6h2ra7kjyq"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://1x4iq56rhc18" path="res://sprites/health_potions.png" id="1_p0sdo"]
|
||||||
|
[ext_resource type="Script" uid="uid://cegdd1sravi5m" path="res://scripts/components/heal_component.gd" id="2_piwlp"]
|
||||||
|
[ext_resource type="Script" uid="uid://pa1bwc4no08q" path="res://scripts/components/collectable.gd" id="3_k2tv6"]
|
||||||
|
[ext_resource type="Resource" uid="uid://2tl3yoh202no" path="res://resources/collectables/small_health_potion.tres" id="4_p0sdo"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_uj2v5"]
|
||||||
|
radius = 7.0
|
||||||
|
|
||||||
|
[node name="SmallHealPotion" type="Area2D"]
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_uj2v5")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_p0sdo")
|
||||||
|
hframes = 4
|
||||||
|
frame = 1
|
||||||
|
|
||||||
|
[node name="HealComponent" type="Node" parent="." node_paths=PackedStringArray("collectable")]
|
||||||
|
script = ExtResource("2_piwlp")
|
||||||
|
collectable = NodePath("../CollectableComponent")
|
||||||
|
|
||||||
|
[node name="CollectableComponent" type="Node" parent="." node_paths=PackedStringArray("area2d", "collision_shape")]
|
||||||
|
script = ExtResource("3_k2tv6")
|
||||||
|
area2d = NodePath("..")
|
||||||
|
collision_shape = NodePath("../CollisionShape2D")
|
||||||
|
collectable_data = ExtResource("4_p0sdo")
|
||||||
|
metadata/_custom_type_script = "uid://pa1bwc4no08q"
|
80
objects/fxs/terrain_hit_fx.tscn
Normal file
80
objects/fxs/terrain_hit_fx.tscn
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
[gd_scene load_steps=8 format=3 uid="uid://c1iorglk708g0"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://djfejwp6e402k" path="res://scripts/components/terrain_hit_fx.gd" id="1_22p6x"]
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture1D" id="GradientTexture1D_6dbny"]
|
||||||
|
|
||||||
|
[sub_resource type="Curve" id="Curve_22p6x"]
|
||||||
|
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.743682, 0.699254), -0.879484, -0.879484, 0, 0, Vector2(1, 0.0104477), 2.07887, 0.0, 0, 0]
|
||||||
|
point_count = 3
|
||||||
|
|
||||||
|
[sub_resource type="CurveTexture" id="CurveTexture_nm1g5"]
|
||||||
|
curve = SubResource("Curve_22p6x")
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hryxg"]
|
||||||
|
lifetime_randomness = 0.1
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
inherit_velocity_ratio = -0.5
|
||||||
|
direction = Vector3(0, 0, 0)
|
||||||
|
spread = 180.0
|
||||||
|
initial_velocity_max = 32.0
|
||||||
|
gravity = Vector3(0, 98, 0)
|
||||||
|
scale_curve = SubResource("CurveTexture_nm1g5")
|
||||||
|
color = Color(0.47451, 0.254902, 0, 1)
|
||||||
|
color_ramp = SubResource("GradientTexture1D_6dbny")
|
||||||
|
turbulence_noise_speed = Vector3(2.73, 5.225, 0)
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_hyh53"]
|
||||||
|
lifetime_randomness = 0.2
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
inherit_velocity_ratio = -0.5
|
||||||
|
direction = Vector3(0, 0, 0)
|
||||||
|
spread = 180.0
|
||||||
|
initial_velocity_max = 32.0
|
||||||
|
gravity = Vector3(0, 98, 0)
|
||||||
|
scale_min = 0.8
|
||||||
|
scale_max = 0.9
|
||||||
|
scale_curve = SubResource("CurveTexture_nm1g5")
|
||||||
|
color = Color(0.47451, 0.254902, 0, 1)
|
||||||
|
turbulence_noise_speed = Vector3(2.73, 5.225, 0)
|
||||||
|
|
||||||
|
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_n5pa8"]
|
||||||
|
lifetime_randomness = 0.1
|
||||||
|
particle_flag_disable_z = true
|
||||||
|
inherit_velocity_ratio = -0.5
|
||||||
|
direction = Vector3(0, 0, 0)
|
||||||
|
spread = 180.0
|
||||||
|
initial_velocity_max = 32.0
|
||||||
|
gravity = Vector3(0, 98, 0)
|
||||||
|
scale_min = 0.9
|
||||||
|
scale_curve = SubResource("CurveTexture_nm1g5")
|
||||||
|
color = Color(0.764706, 0.443137, 0, 1)
|
||||||
|
turbulence_noise_speed = Vector3(2.73, 5.225, 0)
|
||||||
|
|
||||||
|
[node name="TerrainHitFX" type="GPUParticles2D"]
|
||||||
|
emitting = false
|
||||||
|
amount = 24
|
||||||
|
lifetime = 0.35
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 1.0
|
||||||
|
fixed_fps = 24
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_hryxg")
|
||||||
|
script = ExtResource("1_22p6x")
|
||||||
|
|
||||||
|
[node name="TerrainHitFX2" type="GPUParticles2D" parent="."]
|
||||||
|
emitting = false
|
||||||
|
amount = 24
|
||||||
|
lifetime = 0.35
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 1.0
|
||||||
|
fixed_fps = 24
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_hyh53")
|
||||||
|
|
||||||
|
[node name="TerrainHitFX" type="GPUParticles2D" parent="."]
|
||||||
|
emitting = false
|
||||||
|
amount = 24
|
||||||
|
lifetime = 0.35
|
||||||
|
one_shot = true
|
||||||
|
explosiveness = 1.0
|
||||||
|
fixed_fps = 24
|
||||||
|
process_material = SubResource("ParticleProcessMaterial_n5pa8")
|
@@ -4,4 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_fudbo")
|
script = ExtResource("1_fudbo")
|
||||||
amount = 5
|
amount = 5.0
|
||||||
|
type = 0
|
||||||
|
@@ -4,4 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_037vi")
|
script = ExtResource("1_037vi")
|
||||||
amount = 100
|
amount = 100.0
|
||||||
|
type = 0
|
||||||
|
@@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_2d5tb")
|
script = ExtResource("1_2d5tb")
|
||||||
amount = 1
|
amount = 1.0
|
||||||
type = 1
|
type = 1
|
||||||
|
@@ -4,4 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_veemo")
|
script = ExtResource("1_veemo")
|
||||||
amount = 1
|
amount = 1.0
|
||||||
|
type = 0
|
||||||
|
9
resources/collectables/small_health_potion.tres
Normal file
9
resources/collectables/small_health_potion.tres
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[gd_resource type="Resource" script_class="CollectableResource" load_steps=2 format=3 uid="uid://2tl3yoh202no"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cb5f0mx0hrt3b" path="res://scripts/resources/collectable_resource.gd" id="1_brkhb"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_brkhb")
|
||||||
|
amount = 0.25
|
||||||
|
type = 2
|
||||||
|
metadata/_custom_type_script = "uid://cb5f0mx0hrt3b"
|
@@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
script = ExtResource("1_w50p5")
|
script = ExtResource("1_w50p5")
|
||||||
amount = 50
|
amount = 50.0
|
||||||
type = 0
|
type = 0
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=32 format=4 uid="uid://h60obxmju6mo"]
|
[gd_scene load_steps=33 format=4 uid="uid://h60obxmju6mo"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="1_p30ax"]
|
[ext_resource type="PackedScene" uid="uid://dyp4i4ru2j2jh" path="res://objects/fxs/explosion_fx.tscn" id="1_p30ax"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fxs/fire_fx.tscn" id="2_a7yjf"]
|
[ext_resource type="PackedScene" uid="uid://dx80ivlvuuew4" path="res://objects/fxs/fire_fx.tscn" id="2_a7yjf"]
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
[ext_resource type="Script" uid="uid://8r1y8elyw7kt" path="res://scripts/console_management.gd" id="19_0pba3"]
|
[ext_resource type="Script" uid="uid://8r1y8elyw7kt" path="res://scripts/console_management.gd" id="19_0pba3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cawlpch2lk3a2" path="res://objects/level/world_environment.tscn" id="20_embdf"]
|
[ext_resource type="PackedScene" uid="uid://cawlpch2lk3a2" path="res://objects/level/world_environment.tscn" id="20_embdf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cywsu7yrtjdog" path="res://objects/level/global_light.tscn" id="21_fytod"]
|
[ext_resource type="PackedScene" uid="uid://cywsu7yrtjdog" path="res://objects/level/global_light.tscn" id="21_fytod"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://t6h2ra7kjyq" path="res://objects/entities/small_heal_potion.tscn" id="23_m6h4x"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7bvy"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7bvy"]
|
||||||
texture = ExtResource("7_uvxky")
|
texture = ExtResource("7_uvxky")
|
||||||
@@ -356,6 +357,15 @@ skill_manager = NodePath("../Brick Player/SkillManager")
|
|||||||
|
|
||||||
[node name="Global Light" parent="." instance=ExtResource("21_fytod")]
|
[node name="Global Light" parent="." instance=ExtResource("21_fytod")]
|
||||||
|
|
||||||
|
[node name="SmallHealPotion" parent="." instance=ExtResource("23_m6h4x")]
|
||||||
|
position = Vector2(1074, -105)
|
||||||
|
|
||||||
|
[node name="SmallHealPotion2" parent="." instance=ExtResource("23_m6h4x")]
|
||||||
|
position = Vector2(1244, -41)
|
||||||
|
|
||||||
|
[node name="SmallHealPotion3" parent="." instance=ExtResource("23_m6h4x")]
|
||||||
|
position = Vector2(1359, -42)
|
||||||
|
|
||||||
[connection signal="on_death" from="Brick Player/HealthComponent" to="UI Layer/DeathScreen" method="on_player_death"]
|
[connection signal="on_death" from="Brick Player/HealthComponent" to="UI Layer/DeathScreen" method="on_player_death"]
|
||||||
[connection signal="on_death" from="Brick Player/HealthComponent" to="UI Layer/GameOverScreen" method="on_player_death"]
|
[connection signal="on_death" from="Brick Player/HealthComponent" to="UI Layer/GameOverScreen" method="on_player_death"]
|
||||||
|
|
||||||
|
@@ -3,6 +3,8 @@ extends Node
|
|||||||
|
|
||||||
@export var root: Node2D
|
@export var root: Node2D
|
||||||
@export var area2d: Area2D
|
@export var area2d: Area2D
|
||||||
|
@export var hit_terrain_fx: TerrainHitFx
|
||||||
|
@export var bullet_sprite: Sprite2D
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -10,9 +12,26 @@ func _ready() -> void:
|
|||||||
area2d.area_entered.connect(on_area2d_area_entered)
|
area2d.area_entered.connect(on_area2d_area_entered)
|
||||||
|
|
||||||
|
|
||||||
func on_area2d_body_entered(_body: Node2D) -> void:
|
|
||||||
|
func on_area2d_body_entered(body: Node2D) -> void:
|
||||||
|
if body is TileMapLayer:
|
||||||
|
if bullet_sprite:
|
||||||
|
bullet_sprite.visible = false
|
||||||
|
play_terrain_hit_fx()
|
||||||
|
return
|
||||||
|
|
||||||
root.queue_free()
|
root.queue_free()
|
||||||
|
|
||||||
|
|
||||||
func on_area2d_area_entered(_area: Area2D) -> void:
|
func on_area2d_area_entered(_area: Area2D) -> void:
|
||||||
root.queue_free()
|
root.queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func play_terrain_hit_fx() -> void:
|
||||||
|
if not hit_terrain_fx:
|
||||||
|
return
|
||||||
|
|
||||||
|
await hit_terrain_fx.trigger_fx()
|
||||||
|
|
||||||
|
root.queue_free()
|
||||||
|
@@ -8,7 +8,7 @@ var has_fade_away: bool = false
|
|||||||
@export var collision_shape: CollisionShape2D
|
@export var collision_shape: CollisionShape2D
|
||||||
@export var collectable_data: CollectableResource
|
@export var collectable_data: CollectableResource
|
||||||
@export var sfx: AudioStreamPlayer2D
|
@export var sfx: AudioStreamPlayer2D
|
||||||
signal collected(amount: int, type: CollectableResource.CollectableType)
|
signal collected(amount: Variant, type: CollectableResource.CollectableType, body: Node2D)
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
@@ -25,11 +25,12 @@ func _ready() -> void:
|
|||||||
|
|
||||||
func _on_area2d_body_entered(body: Node2D) -> void:
|
func _on_area2d_body_entered(body: Node2D) -> void:
|
||||||
if body.has_node("CanPickUpComponent"):
|
if body.has_node("CanPickUpComponent"):
|
||||||
collected.emit(collectable_data.amount, collectable_data.type)
|
collected.emit(collectable_data.amount, collectable_data.type, body)
|
||||||
if collision_shape:
|
if collision_shape:
|
||||||
collision_shape.call_deferred("set_disabled", true)
|
collision_shape.call_deferred("set_disabled", true)
|
||||||
if sfx:
|
if sfx:
|
||||||
sfx.play()
|
sfx.play()
|
||||||
if not has_fade_away:
|
if not has_fade_away:
|
||||||
|
if sfx:
|
||||||
await sfx.finished
|
await sfx.finished
|
||||||
root.queue_free()
|
root.queue_free()
|
||||||
|
1
scripts/components/enemy_wave_trigger.gd.uid
Normal file
1
scripts/components/enemy_wave_trigger.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://tmahwsvpkrbv
|
40
scripts/components/heal_component.gd
Normal file
40
scripts/components/heal_component.gd
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
class_name HealComponent
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var heal_fx: GPUParticles2D
|
||||||
|
@export var collectable: CollectableComponent
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if not collectable:
|
||||||
|
printerr("HealComponent: No CollectableComponent assigned.")
|
||||||
|
return
|
||||||
|
|
||||||
|
collectable.collected.connect(on_collected)
|
||||||
|
|
||||||
|
|
||||||
|
func on_collected(amount: float, type: CollectableResource.CollectableType, _body: Node2D) -> void:
|
||||||
|
if type != CollectableResource.CollectableType.HEALTH:
|
||||||
|
return
|
||||||
|
|
||||||
|
if not collectable:
|
||||||
|
printerr("HealComponent: No CollectableComponent assigned.")
|
||||||
|
return
|
||||||
|
|
||||||
|
var health_component := _body.get_node_or_null("HealthComponent") as HealthComponent
|
||||||
|
if not health_component or not health_component is HealthComponent:
|
||||||
|
printerr("HealComponent: No HealthComponent found on collected body.")
|
||||||
|
return
|
||||||
|
health_component.increase_health(amount)
|
||||||
|
if heal_fx:
|
||||||
|
play_heal_fx()
|
||||||
|
else:
|
||||||
|
owner.queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
func play_heal_fx() -> void:
|
||||||
|
if not heal_fx:
|
||||||
|
return
|
||||||
|
|
||||||
|
heal_fx.restart()
|
||||||
|
heal_fx.emitting = true
|
1
scripts/components/heal_component.gd.uid
Normal file
1
scripts/components/heal_component.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cegdd1sravi5m
|
@@ -56,7 +56,7 @@ func decrease_health(value: float):
|
|||||||
|
|
||||||
|
|
||||||
func increase_health(value: float):
|
func increase_health(value: float):
|
||||||
var delta = _get_delta(value)
|
var delta := _get_delta(value)
|
||||||
|
|
||||||
health += value
|
health += value
|
||||||
|
|
||||||
@@ -65,7 +65,6 @@ func increase_health(value: float):
|
|||||||
on_health_change.emit(delta, health)
|
on_health_change.emit(delta, health)
|
||||||
return
|
return
|
||||||
|
|
||||||
health += value
|
|
||||||
if heal_fx:
|
if heal_fx:
|
||||||
heal_fx.play()
|
heal_fx.play()
|
||||||
on_health_change.emit(delta, health)
|
on_health_change.emit(delta, health)
|
||||||
|
@@ -43,6 +43,8 @@ func _process(_delta: float) -> void:
|
|||||||
else:
|
else:
|
||||||
rotation_target.rotation = 0
|
rotation_target.rotation = 0
|
||||||
|
|
||||||
|
calculate_jump_vars()
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(delta) -> void:
|
func _physics_process(delta) -> void:
|
||||||
if not body or not enabled:
|
if not body or not enabled:
|
||||||
@@ -106,6 +108,11 @@ func handle_direction(input_dir: float) -> Vector2:
|
|||||||
return last_direction
|
return last_direction
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func on_ship_entered() -> void:
|
func on_ship_entered() -> void:
|
||||||
rotation_target.rotation = 0
|
rotation_target.rotation = 0
|
||||||
|
|
||||||
|
|
||||||
|
func calculate_jump_vars() -> void:
|
||||||
|
jump_velocity = ((2.0 * jump_height) / jump_time_to_peak) * -1.0
|
||||||
|
jump_gravity = ((-2.0 * jump_height) / (jump_time_to_peak * jump_time_to_peak)) * -1.0
|
||||||
|
fall_gravity = ((-2.0 * jump_height) / (jump_time_to_descent * jump_time_to_descent)) * -1.0
|
67
scripts/components/progressive_damage_component.gd
Normal file
67
scripts/components/progressive_damage_component.gd
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
class_name ProgressiveDamageComponent
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var health_component: HealthComponent
|
||||||
|
@export var sprite: Sprite2D
|
||||||
|
@export var platform_movement: PlatformMovement
|
||||||
|
@export var min_jump_height: float = 60.0
|
||||||
|
@export var jump_reduction_percentage: float = 0.1 # this is a percentage of the jump height per hit
|
||||||
|
|
||||||
|
@onready var max_health: float = health_component.max_health
|
||||||
|
|
||||||
|
var og_jump_height: float = 0.0
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if not health_component:
|
||||||
|
printerr("ProgressiveDamageComponent: health_component is not set.")
|
||||||
|
return
|
||||||
|
if not sprite:
|
||||||
|
printerr("ProgressiveDamageComponent: sprite is not set.")
|
||||||
|
return
|
||||||
|
|
||||||
|
health_component.on_health_change.connect(on_health_change)
|
||||||
|
|
||||||
|
if platform_movement:
|
||||||
|
og_jump_height = platform_movement.jump_height
|
||||||
|
|
||||||
|
|
||||||
|
func get_damage_frame() -> int:
|
||||||
|
if not sprite or not health_component:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
var frames_count := sprite.get_hframes()
|
||||||
|
if frames_count == 0:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
var current_health := health_component.health
|
||||||
|
var health_ratio := current_health / max_health
|
||||||
|
return int(frames_count * (1.0 - health_ratio))
|
||||||
|
|
||||||
|
|
||||||
|
func get_jump_height() -> float:
|
||||||
|
if not platform_movement:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
var jump_height := og_jump_height
|
||||||
|
if jump_height <= 0:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
var damage_frame := get_damage_frame()
|
||||||
|
if damage_frame < 0 or damage_frame >= sprite.get_hframes():
|
||||||
|
return jump_height
|
||||||
|
|
||||||
|
var reduction := jump_reduction_percentage * jump_height
|
||||||
|
var calculated_jump_height := jump_height - (damage_frame * reduction)
|
||||||
|
return max(calculated_jump_height, min_jump_height)
|
||||||
|
|
||||||
|
|
||||||
|
func on_health_change(_delta: float, _total_health: float) -> void:
|
||||||
|
var frame := get_damage_frame()
|
||||||
|
if frame < 0 or frame >= sprite.get_hframes():
|
||||||
|
return
|
||||||
|
|
||||||
|
sprite.frame = frame
|
||||||
|
if platform_movement:
|
||||||
|
platform_movement.jump_height = get_jump_height()
|
||||||
|
|
1
scripts/components/progressive_damage_component.gd.uid
Normal file
1
scripts/components/progressive_damage_component.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://d32kd83lf86iy
|
@@ -19,7 +19,8 @@ func _ready() -> void:
|
|||||||
collectable.collected.connect(on_collected)
|
collectable.collected.connect(on_collected)
|
||||||
|
|
||||||
|
|
||||||
func on_collected(amount: int, type: CollectableResource.CollectableType) -> void:
|
|
||||||
|
func on_collected(amount: int, type: CollectableResource.CollectableType, _body: Node2D) -> void:
|
||||||
if type != requirement_type:
|
if type != requirement_type:
|
||||||
return
|
return
|
||||||
add_progress(amount)
|
add_progress(amount)
|
||||||
|
24
scripts/components/terrain_hit_fx.gd
Normal file
24
scripts/components/terrain_hit_fx.gd
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
class_name TerrainHitFx
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var gpu_particles: Array[GPUParticles2D] = []
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if owner is GPUParticles2D:
|
||||||
|
gpu_particles.append(owner)
|
||||||
|
|
||||||
|
for child in get_children():
|
||||||
|
if child is GPUParticles2D:
|
||||||
|
gpu_particles.append(child)
|
||||||
|
|
||||||
|
|
||||||
|
func trigger_fx() -> Signal:
|
||||||
|
for fx in gpu_particles:
|
||||||
|
if fx:
|
||||||
|
fx.restart()
|
||||||
|
fx.emitting = true
|
||||||
|
return gpu_particles[0].finished
|
||||||
|
|
||||||
|
|
||||||
|
|
1
scripts/components/terrain_hit_fx.gd.uid
Normal file
1
scripts/components/terrain_hit_fx.gd.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://djfejwp6e402k
|
@@ -6,5 +6,5 @@ enum CollectableType {
|
|||||||
KID,
|
KID,
|
||||||
HEALTH,
|
HEALTH,
|
||||||
}
|
}
|
||||||
@export var amount: int = 0
|
@export var amount: Variant = 0.0
|
||||||
@export var type: CollectableType = CollectableType.COIN
|
@export var type: CollectableType = CollectableType.COIN
|
BIN
sprites/MrBrick_base-sheet.png
Normal file
BIN
sprites/MrBrick_base-sheet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 577 B |
34
sprites/MrBrick_base-sheet.png.import
Normal file
34
sprites/MrBrick_base-sheet.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://0l454rfplmqg"
|
||||||
|
path="res://.godot/imported/MrBrick_base-sheet.png-48bb6ed32601bab7bff225ba37ca675b.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/MrBrick_base-sheet.png"
|
||||||
|
dest_files=["res://.godot/imported/MrBrick_base-sheet.png-48bb6ed32601bab7bff225ba37ca675b.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
BIN
sprites/health_potions.png
Normal file
BIN
sprites/health_potions.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 476 B |
34
sprites/health_potions.png.import
Normal file
34
sprites/health_potions.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://1x4iq56rhc18"
|
||||||
|
path="res://.godot/imported/health_potions.png-2a428c62301dffcc03dfe6d0e2934ba4.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://sprites/health_potions.png"
|
||||||
|
dest_files=["res://.godot/imported/health_potions.png-2a428c62301dffcc03dfe6d0e2934ba4.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
Reference in New Issue
Block a user