From 040d419a279f147f4127ad2246bc61cc50b2ee7f Mon Sep 17 00:00:00 2001 From: Rendo Date: Thu, 26 Jun 2025 23:01:12 +0500 Subject: [PATCH] balance changes --- scenes/debug_lvl.tscn | 52 ++++++++++++++++++- scenes/entities/Zombies/bucket_zombie.tscn | 5 +- scenes/entities/Zombies/cone_zombie.tscn | 30 +++++++++-- scenes/entities/Zombies/hobo.tscn | 3 +- scenes/entities/plants/garlic.tscn | 2 +- scenes/entities/plants/peashooter.tscn | 2 +- scenes/entities/plants/potato_mine.tscn | 2 +- scenes/entities/plants/spikeweed.tscn | 7 ++- scenes/entities/plants/sunflower.tscn | 3 +- scenes/entities/plants/wallnut.tscn | 2 +- scenes/prototype_survival.tscn | 48 ++++++++++++++++- scenes/templates/plant_template.tscn | 1 + scripts/components/particles/FallFloor.cs | 41 +++++++++++++++ scripts/components/particles/FallFloor.cs.uid | 1 + scripts/components/particles/FallParticle.cs | 20 +++++++ .../components/particles/FallParticle.cs.uid | 1 + 16 files changed, 203 insertions(+), 17 deletions(-) create mode 100644 scripts/components/particles/FallFloor.cs create mode 100644 scripts/components/particles/FallFloor.cs.uid create mode 100644 scripts/components/particles/FallParticle.cs create mode 100644 scripts/components/particles/FallParticle.cs.uid diff --git a/scenes/debug_lvl.tscn b/scenes/debug_lvl.tscn index d3fb90c..e888770 100644 --- a/scenes/debug_lvl.tscn +++ b/scenes/debug_lvl.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://crxsvv7drckpw"] +[gd_scene load_steps=12 format=3 uid="uid://crxsvv7drckpw"] [ext_resource type="Script" uid="uid://bndu1h5kgcde8" path="res://scripts/components/level/RuntimeLevelData.cs" id="1_i3bf5"] [ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="2_vmxhy"] @@ -8,6 +8,10 @@ [ext_resource type="PackedScene" uid="uid://cfnmspei3k4p7" path="res://scenes/gui/runtime_gui.tscn" id="6_0baou"] [ext_resource type="PackedScene" uid="uid://bpekho7leatr5" path="res://scenes/sun.tscn" id="6_ay12k"] [ext_resource type="Script" uid="uid://cslqjdd5wq4rc" path="res://scripts/components/level/SunSpawner.cs" id="6_lkguy"] +[ext_resource type="PackedScene" uid="uid://hhjbqkjqpt7x" path="res://scenes/entities/Zombies/cone_zombie.tscn" id="9_3uwe7"] +[ext_resource type="Script" uid="uid://blpu7t8tf6277" path="res://scripts/components/particles/FallFloor.cs" id="10_q4fsb"] + +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_tbxxq"] [node name="debug_lvl" type="Node2D"] y_sort_enabled = true @@ -72,4 +76,50 @@ SunScene = ExtResource("6_ay12k") wait_time = 5.0 autostart = true +[node name="ConeZombie" parent="." instance=ExtResource("9_3uwe7")] +position = Vector2(772, 255) + +[node name="Lines" type="Node2D" parent="."] +script = ExtResource("10_q4fsb") + +[node name="Floor" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 247) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor"] +shape = SubResource("WorldBoundaryShape2D_tbxxq") + +[node name="Floor2" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 306) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor2"] +shape = SubResource("WorldBoundaryShape2D_tbxxq") + +[node name="Floor3" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 367) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor3"] +shape = SubResource("WorldBoundaryShape2D_tbxxq") + +[node name="Floor4" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 183) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor4"] +shape = SubResource("WorldBoundaryShape2D_tbxxq") + +[node name="Floor5" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 132) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor5"] +shape = SubResource("WorldBoundaryShape2D_tbxxq") + [connection signal="timeout" from="SunSpawner/Timer" to="SunSpawner" method="Spawn"] diff --git a/scenes/entities/Zombies/bucket_zombie.tscn b/scenes/entities/Zombies/bucket_zombie.tscn index 7741a44..e10e3fd 100644 --- a/scenes/entities/Zombies/bucket_zombie.tscn +++ b/scenes/entities/Zombies/bucket_zombie.tscn @@ -31,7 +31,10 @@ mult_value = 1.0 material = SubResource("ShaderMaterial_wdi07") [node name="Hat" parent="CanvasGroup" index="1"] -position = Vector2(-12, -83) +position = Vector2(-13, -82) + +[node name="Sprite" parent="CanvasGroup/Hat" index="0"] +position = Vector2(1, 0) texture = ExtResource("3_0nlp0") [node name="Eatbox" parent="." index="2"] diff --git a/scenes/entities/Zombies/cone_zombie.tscn b/scenes/entities/Zombies/cone_zombie.tscn index 3fdcade..152aada 100644 --- a/scenes/entities/Zombies/cone_zombie.tscn +++ b/scenes/entities/Zombies/cone_zombie.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=9 format=3 uid="uid://hhjbqkjqpt7x"] +[gd_scene load_steps=11 format=3 uid="uid://hhjbqkjqpt7x"] [ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_3dq4c"] [ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_2dq8e"] [ext_resource type="Script" uid="uid://fd4im1fmwc5n" path="res://scripts/components/Armor.cs" id="3_5s7in"] +[ext_resource type="Script" uid="uid://dt5uj25u0g6y3" path="res://scripts/components/particles/FallParticle.cs" id="3_w70im"] [ext_resource type="Texture2D" uid="uid://ceqvdmude7cgg" path="res://assets/sprites/cone.tres" id="4_qdhik"] [ext_resource type="Script" uid="uid://c3cfnrmnnuqms" path="res://addons/floatmodifiers/FloatModifiers.cs" id="4_qof5v"] @@ -12,6 +13,8 @@ shader = ExtResource("2_2dq8e") shader_parameter/blend_color = Color(1, 1, 1, 1) shader_parameter/amount = 0.0 +[sub_resource type="CircleShape2D" id="CircleShape2D_67t4t"] + [sub_resource type="Resource" id="Resource_w70im"] resource_local_to_scene = true script = ExtResource("4_qof5v") @@ -32,10 +35,28 @@ _armor = NodePath("Armor") [node name="CanvasGroup" parent="." index="0"] material = SubResource("ShaderMaterial_sat5k") -[node name="Hat" type="Sprite2D" parent="CanvasGroup" index="1"] -position = Vector2(-12, -88) +[node name="Hat" type="RigidBody2D" parent="CanvasGroup" index="1" node_paths=PackedStringArray("data", "deathTimer")] +position = Vector2(-12, -78) +collision_layer = 128 +collision_mask = 64 +mass = 0.5 +center_of_mass_mode = 1 +freeze = true +script = ExtResource("3_w70im") +data = NodePath("../..") +deathTimer = NodePath("Timer") + +[node name="Sprite" type="Sprite2D" parent="CanvasGroup/Hat" index="0"] +position = Vector2(2, -10) texture = ExtResource("4_qdhik") +[node name="CollisionShape2D" type="CollisionShape2D" parent="CanvasGroup/Hat" index="1"] +position = Vector2(4, -4) +shape = SubResource("CircleShape2D_67t4t") + +[node name="Timer" type="Timer" parent="CanvasGroup/Hat" index="2"] +wait_time = 5.0 + [node name="Eatbox" parent="." index="2"] _damage = SubResource("Resource_w70im") @@ -46,4 +67,5 @@ _speed = SubResource("Resource_qof5v") script = ExtResource("3_5s7in") _maxHP = 130 -[connection signal="ArmorLost" from="Armor" to="CanvasGroup/Hat" method="queue_free"] +[connection signal="timeout" from="CanvasGroup/Hat/Timer" to="CanvasGroup/Hat" method="queue_free"] +[connection signal="ArmorLost" from="Armor" to="CanvasGroup/Hat" method="FallOff"] diff --git a/scenes/entities/Zombies/hobo.tscn b/scenes/entities/Zombies/hobo.tscn index 58fad32..ec543f8 100644 --- a/scenes/entities/Zombies/hobo.tscn +++ b/scenes/entities/Zombies/hobo.tscn @@ -200,6 +200,7 @@ percentage_value = 0.0 mult_value = 1.0 [node name="Hobo" node_paths=PackedStringArray("_armor") instance=ExtResource("1_fnu7s")] +_maxHP = 130 _armor = NodePath("CanArmor") [node name="CanvasGroup" parent="." index="0"] @@ -237,7 +238,7 @@ _speed = SubResource("Resource_4248q") [node name="CanArmor" type="Node" parent="." index="7"] script = ExtResource("4_w8pya") -_maxHP = 180 +_maxHP = 385 metadata/_custom_type_script = "uid://fd4im1fmwc5n" [node name="Behaviour" type="Node" parent="." index="8" node_paths=PackedStringArray("_eatBox", "_animationTree")] diff --git a/scenes/entities/plants/garlic.tscn b/scenes/entities/plants/garlic.tscn index 338c16f..67c316e 100644 --- a/scenes/entities/plants/garlic.tscn +++ b/scenes/entities/plants/garlic.tscn @@ -50,7 +50,7 @@ blend_mode = 1 size = Vector2(32, 29) [node name="Garlic" instance=ExtResource("1_5i0e6")] -_maxHP = 600 +_maxHP = 200 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_w2jbi") diff --git a/scenes/entities/plants/peashooter.tscn b/scenes/entities/plants/peashooter.tscn index 80bd2df..d39dedf 100644 --- a/scenes/entities/plants/peashooter.tscn +++ b/scenes/entities/plants/peashooter.tscn @@ -60,7 +60,7 @@ resource_local_to_scene = true size = Vector2(20, 44) [node name="Peashooter" instance=ExtResource("1_pyk3o")] -_maxHP = 100 +_maxHP = 30 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_14qlx") diff --git a/scenes/entities/plants/potato_mine.tscn b/scenes/entities/plants/potato_mine.tscn index 88b75d9..03128c9 100644 --- a/scenes/entities/plants/potato_mine.tscn +++ b/scenes/entities/plants/potato_mine.tscn @@ -64,7 +64,7 @@ size = Vector2(15, 27) size = Vector2(34, 19) [node name="Potato mine" instance=ExtResource("1_dj7ul")] -_maxHP = 100 +_maxHP = 20 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_sneas") diff --git a/scenes/entities/plants/spikeweed.tscn b/scenes/entities/plants/spikeweed.tscn index d740250..b8384da 100644 --- a/scenes/entities/plants/spikeweed.tscn +++ b/scenes/entities/plants/spikeweed.tscn @@ -2,9 +2,9 @@ [ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_vmbvr"] [ext_resource type="Texture2D" uid="uid://coafh3mjharxo" path="res://assets/sprites/atlases/plants/spikeweed.png" id="2_ffrjr"] -[ext_resource type="Script" path="res://scripts/components/plants/AreaAttack.cs" id="3_hqtbm"] +[ext_resource type="Script" uid="uid://co7ttejdo2qot" path="res://scripts/components/plants/AreaAttack.cs" id="3_hqtbm"] [ext_resource type="AnimationLibrary" uid="uid://cen6ku4y01dyg" path="res://resources/animations/plants/spikeweed.res" id="3_nwshn"] -[ext_resource type="Script" path="res://scripts/components/plants/behaviours/SpikeweedBehaviour.cs" id="3_uhpn7"] +[ext_resource type="Script" uid="uid://dqquodxaijmem" path="res://scripts/components/plants/behaviours/SpikeweedBehaviour.cs" id="3_uhpn7"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_lmfqg"] animation = &"spikeweed/idle" @@ -26,7 +26,6 @@ blend_mode = 1 size = Vector2(49, 38) [node name="Spikeweed" instance=ExtResource("1_vmbvr")] -_maxHP = 100 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_ffrjr") @@ -36,7 +35,7 @@ frame = 8 [node name="AnimationPlayer" parent="." index="1"] libraries = { -"spikeweed": ExtResource("3_nwshn") +&"spikeweed": ExtResource("3_nwshn") } [node name="AnimationTree" parent="." index="2"] diff --git a/scenes/entities/plants/sunflower.tscn b/scenes/entities/plants/sunflower.tscn index 156f60a..2f23a96 100644 --- a/scenes/entities/plants/sunflower.tscn +++ b/scenes/entities/plants/sunflower.tscn @@ -55,12 +55,13 @@ transitions = ["Start", "sunflower_idle", SubResource("AnimationNodeStateMachine size = Vector2(26, 48) [node name="Sunflower" instance=ExtResource("1_bikjn")] +_maxHP = 30 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_fwcda") hframes = 9 vframes = 2 -frame = 2 +frame = 1 [node name="AnimationPlayer" parent="." index="1"] libraries = { diff --git a/scenes/entities/plants/wallnut.tscn b/scenes/entities/plants/wallnut.tscn index 35a0a56..c172343 100644 --- a/scenes/entities/plants/wallnut.tscn +++ b/scenes/entities/plants/wallnut.tscn @@ -28,7 +28,7 @@ blend_mode = 1 size = Vector2(33, 46) [node name="Wallnut" instance=ExtResource("1_fluxn")] -_maxHP = 1000 +_maxHP = 450 [node name="Sprite2D" parent="." index="0"] texture = ExtResource("2_o5tda") diff --git a/scenes/prototype_survival.tscn b/scenes/prototype_survival.tscn index cb4bd37..0830cf6 100644 --- a/scenes/prototype_survival.tscn +++ b/scenes/prototype_survival.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://c1335fke4thpm"] +[gd_scene load_steps=17 format=3 uid="uid://c1335fke4thpm"] [ext_resource type="Script" uid="uid://bndu1h5kgcde8" path="res://scripts/components/level/RuntimeLevelData.cs" id="1_tnxdx"] [ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="1_vafkg"] @@ -12,6 +12,7 @@ [ext_resource type="PackedScene" uid="uid://jm7wm08d2mi7" path="res://scenes/level components/right_boundary_marker.tscn" id="9_q2l3d"] [ext_resource type="Script" uid="uid://nkb6i7lrkl8y" path="res://scripts/components/level/zombe_spawners/SurvivalZombieSpawner.cs" id="10_1kjp6"] [ext_resource type="PackedScene" uid="uid://plc2gus4ppds" path="res://scenes/level components/left_boundary_marker.tscn" id="10_5h8lk"] +[ext_resource type="Script" uid="uid://blpu7t8tf6277" path="res://scripts/components/particles/FallFloor.cs" id="13_5h8lk"] [sub_resource type="GDScript" id="GDScript_1kjp6"] resource_name = "zombiePoints" @@ -27,6 +28,8 @@ _limits = [0.0, 5.0, 0.0, 2000.0] _data = [Vector2(0, 0), 0.0, 0.000634783, 0, 0, Vector2(19.8456, 0.0978518), 0.0, 0.0, 0, 0, Vector2(114.664, 0.12832), 0.0, 0.0, 0, 0, Vector2(213.892, 0.465625), 0.0017272, 0.00230293, 0, 0, Vector2(1499.45, 2.99414), 0.0, 0.00350837, 0, 0, Vector2(2000, 5), 0.00737658, 0.0, 0, 0] point_count = 6 +[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_3ghv7"] + [node name="PrototypeSurvival" type="Node2D"] [node name="Data" type="Node" parent="."] @@ -127,6 +130,49 @@ wait_time = 20.0 one_shot = true autostart = true +[node name="Lines" type="Node2D" parent="."] +script = ExtResource("13_5h8lk") + +[node name="Floor" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 247) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor"] +shape = SubResource("WorldBoundaryShape2D_3ghv7") + +[node name="Floor2" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 306) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor2"] +shape = SubResource("WorldBoundaryShape2D_3ghv7") + +[node name="Floor3" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 367) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor3"] +shape = SubResource("WorldBoundaryShape2D_3ghv7") + +[node name="Floor4" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 183) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor4"] +shape = SubResource("WorldBoundaryShape2D_3ghv7") + +[node name="Floor5" type="StaticBody2D" parent="Lines"] +position = Vector2(528, 132) +collision_layer = 64 +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Lines/Floor5"] +shape = SubResource("WorldBoundaryShape2D_3ghv7") + [connection signal="timeout" from="SunSpawner/Timer" to="SunSpawner" method="Spawn"] [connection signal="timeout" from="ZombieSequencer/Timer" to="ZombieSequencer" method="FormSquad"] [connection signal="timeout" from="SurvivalAI/Timer" to="SurvivalAI" method="SummonWave"] diff --git a/scenes/templates/plant_template.tscn b/scenes/templates/plant_template.tscn index 685838b..2266c6a 100644 --- a/scenes/templates/plant_template.tscn +++ b/scenes/templates/plant_template.tscn @@ -4,6 +4,7 @@ [node name="PlantTemplate" type="Node2D"] script = ExtResource("1_324sd") +_maxHP = 30 [node name="Sprite2D" type="Sprite2D" parent="."] use_parent_material = true diff --git a/scripts/components/particles/FallFloor.cs b/scripts/components/particles/FallFloor.cs new file mode 100644 index 0000000..b562fc0 --- /dev/null +++ b/scripts/components/particles/FallFloor.cs @@ -0,0 +1,41 @@ +using System; +using Godot; +using Godot.Collections; + +public partial class FallFloor : Node2D +{ + private static FallFloor Instance; + private Array bodies = []; + public override void _Ready() + { + Instance = this; + foreach (StaticBody2D body in GetChildren()) + { + bodies.Add(body); + } + } + public static StaticBody2D GetNearest(Vector2 point) + { + var selected = Instance.bodies[0]; + foreach (StaticBody2D body in Instance.bodies) + { + if (Math.Abs(selected.GlobalPosition.Y - point.Y) > Math.Abs(body.GlobalPosition.Y - point.Y)) + { + selected = body; + } + } + return selected; + } + public static Array GetEverythingElse(StaticBody2D except) + { + Array bodys = []; + foreach (StaticBody2D body in Instance.bodies) + { + if (except != body) + { + bodys.Add(body); + } + } + return bodys; + } +} diff --git a/scripts/components/particles/FallFloor.cs.uid b/scripts/components/particles/FallFloor.cs.uid new file mode 100644 index 0000000..306571d --- /dev/null +++ b/scripts/components/particles/FallFloor.cs.uid @@ -0,0 +1 @@ +uid://blpu7t8tf6277 diff --git a/scripts/components/particles/FallParticle.cs b/scripts/components/particles/FallParticle.cs new file mode 100644 index 0000000..b8598e1 --- /dev/null +++ b/scripts/components/particles/FallParticle.cs @@ -0,0 +1,20 @@ +using Godot; +using Newlon.Components.Level; +using Newlon.Components.Zombies; +using System; + +public partial class FallParticle : RigidBody2D +{ + [Export] private RuntimeZombieData data; + [Export] private Timer deathTimer; + public void FallOff() + { + SetDeferred("freeze", false); + foreach (var floor in FallFloor.GetEverythingElse(FallFloor.GetNearest(data.GlobalPosition))) + { + AddCollisionExceptionWith(floor); + } + Callable.From(()=>{ Reparent(PoolContainer.Instance.Zombies); }).CallDeferred(); + deathTimer.Start(); + } +} diff --git a/scripts/components/particles/FallParticle.cs.uid b/scripts/components/particles/FallParticle.cs.uid new file mode 100644 index 0000000..ce788b3 --- /dev/null +++ b/scripts/components/particles/FallParticle.cs.uid @@ -0,0 +1 @@ +uid://dt5uj25u0g6y3