Debug zombie spawner

This commit is contained in:
Rendo 2025-06-24 18:44:49 +05:00
commit 0fff33d196
69 changed files with 564 additions and 100 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c68mrfs4wb81x"
path="res://.godot/imported/atlas2.png-e622880e29243d7232ebeb6861d4288e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/sprites/atlases/atlas2.png"
dest_files=["res://.godot/imported/atlas2.png-e622880e29243d7232ebeb6861d4288e.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

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_i6oyj") atlas = ExtResource("1_i6oyj")
region = Rect2(0, 300, 36, 36) region = Rect2(177, 40, 36, 36)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_es82j") atlas = ExtResource("1_es82j")
region = Rect2(115, 300, 65, 65) region = Rect2(296, 0, 65, 65)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_bv8ko") atlas = ExtResource("1_bv8ko")
region = Rect2(113, 414, 15, 32) region = Rect2(270, 77, 15, 32)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_vi2yj") atlas = ExtResource("1_vi2yj")
region = Rect2(113, 402, 14, 12) region = Rect2(296, 65, 14, 12)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_wytrb") atlas = ExtResource("1_wytrb")
region = Rect2(87, 382, 41, 20) region = Rect2(512, 221, 41, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_ugykr") atlas = ExtResource("1_ugykr")
region = Rect2(87, 402, 26, 27) region = Rect2(244, 77, 26, 27)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_44qhk") atlas = ExtResource("1_44qhk")
region = Rect2(38, 300, 77, 77) region = Rect2(219, 0, 77, 77)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_auh61") atlas = ExtResource("1_auh61")
region = Rect2(129, 401, 13, 13) region = Rect2(285, 77, 13, 13)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_i8m7w") atlas = ExtResource("1_i8m7w")
region = Rect2(341, 67, 51, 47) region = Rect2(0, 174, 46, 46)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_r6k0p") atlas = ExtResource("1_r6k0p")
region = Rect2(45, 272, 18, 20) region = Rect2(571, 221, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_cq0f1") atlas = ExtResource("1_cq0f1")
region = Rect2(81, 272, 18, 20) region = Rect2(589, 221, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_xsjda") atlas = ExtResource("1_xsjda")
region = Rect2(117, 272, 18, 20) region = Rect2(607, 221, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_qlv5m") atlas = ExtResource("1_qlv5m")
region = Rect2(9, 272, 18, 20) region = Rect2(553, 221, 18, 20)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_safs8") atlas = ExtResource("1_safs8")
region = Rect2(300, 60, 41, 56) region = Rect2(514, 65, 41, 56)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_sqfv1") atlas = ExtResource("1_sqfv1")
region = Rect2(156, 365, 25, 25) region = Rect2(514, 65, 41, 56)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_s2rs0") atlas = ExtResource("1_s2rs0")
region = Rect2(0, 145, 51, 47) region = Rect2(46, 174, 51, 47)

View file

@ -0,0 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://c1pe4mfmeaoq7"]
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_laeru"]
[resource]
atlas = ExtResource("1_laeru")
region = Rect2(0, 0, 177, 174)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_deojb") atlas = ExtResource("1_deojb")
region = Rect2(80, 120, 49, 27) region = Rect2(177, 77, 49, 27)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_h51va") atlas = ExtResource("1_h51va")
region = Rect2(201, 37, 49, 22) region = Rect2(170, 241, 48, 22)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_rqu4e") atlas = ExtResource("1_rqu4e")
region = Rect2(104, 12, 41, 46) region = Rect2(84, 241, 41, 46)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_rq51o") atlas = ExtResource("1_rq51o")
region = Rect2(302, 6, 52, 50) region = Rect2(262, 241, 52, 50)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_el55x") atlas = ExtResource("1_el55x")
region = Rect2(356, 16, 39, 41) region = Rect2(314, 241, 39, 41)

View file

@ -1,7 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dq0mul65hevtt"] [gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dq0mul65hevtt"]
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_soyv1"] [ext_resource type="Texture2D" uid="uid://c68mrfs4wb81x" path="res://assets/sprites/atlases/atlas2.png" id="1_l6gbe"]
[resource] [resource]
atlas = ExtResource("1_soyv1") atlas = ExtResource("1_l6gbe")
region = Rect2(2, 130, 12, 12) region = Rect2(0, 88, 12, 12)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_vhxkc") atlas = ExtResource("1_vhxkc")
region = Rect2(1, 10, 42, 48) region = Rect2(0, 241, 42, 48)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_qntd0") atlas = ExtResource("1_qntd0")
region = Rect2(153, 17, 45, 42) region = Rect2(125, 241, 45, 42)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_pt3id") atlas = ExtResource("1_pt3id")
region = Rect2(253, 5, 43, 54) region = Rect2(219, 241, 43, 54)

View file

@ -1,7 +1,7 @@
[gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dn4l67snkx5mr"] [gd_resource type="AtlasTexture" load_steps=2 format=3 uid="uid://dn4l67snkx5mr"]
[ext_resource type="Texture2D" uid="uid://dvldjlg0nr355" path="res://assets/sprites/atlases/atlas1.png" id="1_ljncc"] [ext_resource type="Texture2D" uid="uid://c68mrfs4wb81x" path="res://assets/sprites/atlases/atlas2.png" id="1_kbnyt"]
[resource] [resource]
atlas = ExtResource("1_ljncc") atlas = ExtResource("1_kbnyt")
region = Rect2(18, 130, 12, 12) region = Rect2(12, 88, 12, 12)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_x8dof") atlas = ExtResource("1_x8dof")
region = Rect2(54, 3, 42, 56) region = Rect2(42, 241, 42, 56)

View file

@ -4,4 +4,4 @@
[resource] [resource]
atlas = ExtResource("1_wwp2c") atlas = ExtResource("1_wwp2c")
region = Rect2(84, 147, 45, 45) region = Rect2(177, 104, 45, 45)

View file

@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="Liberation of the Neighbourville" config/name="Liberation of the Neighbourville"
run/main_scene="res://scenes/debug_lvl.tscn" run/main_scene="uid://c1335fke4thpm"
config/features=PackedStringArray("4.4", "C#", "Forward Plus") config/features=PackedStringArray("4.4", "C#", "Forward Plus")
config/icon="res://icon.png" config/icon="res://icon.png"
config/windows_native_icon="res://icon.ico" config/windows_native_icon="res://icon.ico"
@ -20,6 +20,8 @@ config/windows_native_icon="res://icon.ico"
LevelController="*res://scripts/LevelController.cs" LevelController="*res://scripts/LevelController.cs"
Cursor="*res://scripts/Cursor.cs" Cursor="*res://scripts/Cursor.cs"
GameRegistry="*res://scripts/systems/GameRegistry.cs"
Cheats="*res://scripts/debug/Cheats.cs"
[display] [display]
@ -32,11 +34,16 @@ window/per_pixel_transparency/allowed=true
project/assembly_name="NewLON" project/assembly_name="NewLON"
[editor_plugins]
enabled=PackedStringArray("res://addons/floatmodifiers/plugin.cfg")
[file_customization] [file_customization]
folder_colors={ folder_colors={
"res://assets/sprites/atlases/plants/": "green", "res://assets/sprites/atlases/plants/": "green",
"res://resources/plants/": "green", "res://resources/plants/": "green",
"res://scenes/": "red",
"res://scenes/entities/plants/": "green" "res://scenes/entities/plants/": "green"
} }
@ -63,6 +70,11 @@ primary_action={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(49, 18),"global_position":Vector2(58, 57),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(49, 18),"global_position":Vector2(58, 57),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
] ]
} }
cheat_zombie_spawn={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194332,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[layer_names] [layer_names]

View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://buvacn56kyy2p"]
[ext_resource type="PackedScene" uid="uid://co11v3w8hbwgf" path="res://scenes/entities/Zombies/zombie.tscn" id="1_c2mq3"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_k277m"]
[resource]
script = ExtResource("1_k277m")
cost = 1
scene = ExtResource("1_c2mq3")
metadata/_custom_type_script = "uid://cqxj7o8hdm82n"

View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://dkhjlu7u0vny6"]
[ext_resource type="PackedScene" uid="uid://xu4i6tmkv00a" path="res://scenes/entities/Zombies/bucket_zombie.tscn" id="1_lhcag"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_sngfh"]
[resource]
script = ExtResource("1_sngfh")
cost = 7
scene = ExtResource("1_lhcag")
metadata/_custom_type_script = "uid://cqxj7o8hdm82n"

View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://nceohd32fkxk"]
[ext_resource type="PackedScene" uid="uid://hhjbqkjqpt7x" path="res://scenes/entities/Zombies/cone_zombie.tscn" id="1_llf5l"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_sw7hj"]
[resource]
script = ExtResource("1_sw7hj")
cost = 3
scene = ExtResource("1_llf5l")
metadata/_custom_type_script = "uid://cqxj7o8hdm82n"

View file

@ -0,0 +1,10 @@
[gd_resource type="Resource" script_class="ZombieResource" load_steps=3 format=3 uid="uid://c38vfdw5b60xw"]
[ext_resource type="PackedScene" uid="uid://bgqmwsb6ynm81" path="res://scenes/entities/Zombies/hobo.tscn" id="1_4myt6"]
[ext_resource type="Script" uid="uid://cqxj7o8hdm82n" path="res://scripts/resources/ZombieResource.cs" id="1_u5qpq"]
[resource]
script = ExtResource("1_u5qpq")
cost = 5
scene = ExtResource("1_4myt6")
metadata/_custom_type_script = "uid://cqxj7o8hdm82n"

View file

@ -1,19 +1,20 @@
[gd_scene load_steps=11 format=3 uid="uid://crxsvv7drckpw"] [gd_scene load_steps=9 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="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"] [ext_resource type="Texture2D" uid="uid://b0tb2hjum40aw" path="res://assets/sprites/background_summer.png" id="2_vmxhy"]
[ext_resource type="PackedScene" uid="uid://cg8713v6c5w15" path="res://scenes/level components/pools.tscn" id="3_jv7x4"] [ext_resource type="Script" uid="uid://bso32xkw738sy" path="res://scripts/components/level/PoolContainer.cs" id="3_1y18w"]
[ext_resource type="PackedScene" uid="uid://dpxxjfd5lv5sv" path="res://scenes/gui/choose_your_seeds.tscn" id="5_5e78h"] [ext_resource type="PackedScene" uid="uid://dpxxjfd5lv5sv" path="res://scenes/gui/choose_your_seeds.tscn" id="5_5e78h"]
[ext_resource type="PackedScene" uid="uid://devn21c7luf45" path="res://scenes/level components/field_controller.tscn" id="5_lwpg6"] [ext_resource type="PackedScene" uid="uid://devn21c7luf45" path="res://scenes/level components/field_controller.tscn" id="5_lwpg6"]
[ext_resource type="PackedScene" uid="uid://cfnmspei3k4p7" path="res://scenes/gui/runtime_gui.tscn" id="6_0baou"] [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="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="Script" uid="uid://cslqjdd5wq4rc" path="res://scripts/components/level/SunSpawner.cs" id="6_lkguy"]
[ext_resource type="PackedScene" uid="uid://xu4i6tmkv00a" path="res://scenes/entities/Zombies/bucket_zombie.tscn" id="9_u7o5c"]
[ext_resource type="PackedScene" uid="uid://hhjbqkjqpt7x" path="res://scenes/entities/Zombies/cone_zombie.tscn" id="10_q4fsb"]
[node name="debug_lvl" type="Node2D"] [node name="debug_lvl" type="Node2D"]
y_sort_enabled = true
[node name="SummertimeSaga" type="Sprite2D" parent="."] [node name="SummertimeSaga" type="Sprite2D" parent="."]
z_index = -4096
z_as_relative = false
position = Vector2(500, 200) position = Vector2(500, 200)
texture = ExtResource("2_vmxhy") texture = ExtResource("2_vmxhy")
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
@ -26,7 +27,28 @@ metadata/_edit_lock_ = true
script = ExtResource("1_i3bf5") script = ExtResource("1_i3bf5")
SunCount = 999999 SunCount = 999999
[node name="Pools" parent="." instance=ExtResource("3_jv7x4")] [node name="Pools" type="Node2D" parent="." node_paths=PackedStringArray("Zombies", "Plants", "Projectiles", "Structures")]
script = ExtResource("3_1y18w")
Zombies = NodePath("Zombies")
Plants = NodePath("Plants")
Projectiles = NodePath("Projectiles")
Structures = NodePath("Structures")
[node name="Zombies" type="Node2D" parent="Pools"]
z_index = 3
y_sort_enabled = true
[node name="Plants" type="Node2D" parent="Pools"]
z_index = 1
y_sort_enabled = true
[node name="Projectiles" type="Node2D" parent="Pools"]
z_index = 4
y_sort_enabled = true
[node name="Structures" type="Node2D" parent="Pools"]
z_index = 2
y_sort_enabled = true
[node name="GuiLayer" type="CanvasLayer" parent="."] [node name="GuiLayer" type="CanvasLayer" parent="."]
layer = 10 layer = 10
@ -50,10 +72,4 @@ SunScene = ExtResource("6_ay12k")
wait_time = 5.0 wait_time = 5.0
autostart = true autostart = true
[node name="BucketZombie" parent="." instance=ExtResource("9_u7o5c")]
position = Vector2(729, 257)
[node name="ConeZombie" parent="." instance=ExtResource("10_q4fsb")]
position = Vector2(729, 313)
[connection signal="timeout" from="SunSpawner/Timer" to="SunSpawner" method="Spawn"] [connection signal="timeout" from="SunSpawner/Timer" to="SunSpawner" method="Spawn"]

View file

@ -0,0 +1,41 @@
[gd_scene load_steps=2 format=3 uid="uid://cubfkr2mkgxjc"]
[ext_resource type="Script" uid="uid://dac0bvlhho7u4" path="res://scripts/DebugZombieSpawner.cs" id="1_m367a"]
[node name="DebugZombieSpawner" type="PopupPanel" node_paths=PackedStringArray("label", "line", "spin")]
initial_position = 1
size = Vector2i(200, 100)
visible = true
script = ExtResource("1_m367a")
label = NodePath("Vbox/Similars")
line = NodePath("Vbox/Line/LineEdit")
spin = NodePath("Vbox/Line/SpinBox")
[node name="Vbox" type="VBoxContainer" parent="."]
offset_left = 4.0
offset_top = 4.0
offset_right = 196.0
offset_bottom = 96.0
[node name="Line" type="HBoxContainer" parent="Vbox"]
layout_mode = 2
[node name="LineEdit" type="LineEdit" parent="Vbox/Line"]
layout_mode = 2
size_flags_horizontal = 3
focus_next = NodePath("../SpinBox")
max_length = 16
[node name="SpinBox" type="SpinBox" parent="Vbox/Line"]
layout_mode = 2
min_value = 1.0
max_value = 50.0
value = 1.0
[node name="Similars" type="Label" parent="Vbox"]
layout_mode = 2
size_flags_vertical = 3
[connection signal="popup_hide" from="." to="." method="OnPopupHide"]
[connection signal="text_changed" from="Vbox/Line/LineEdit" to="." method="OnTextChanged"]
[connection signal="text_submitted" from="Vbox/Line/LineEdit" to="." method="OnTextSubmitted"]

View file

@ -16,8 +16,8 @@ shader_parameter/amount = 0.0
material = SubResource("ShaderMaterial_wdi07") material = SubResource("ShaderMaterial_wdi07")
[node name="Hat" parent="CanvasGroup" index="1"] [node name="Hat" parent="CanvasGroup" index="1"]
position = Vector2(-7, -83) position = Vector2(-12, -83)
texture = ExtResource("3_0nlp0") texture = ExtResource("3_0nlp0")
[node name="Armor" parent="." index="8"] [node name="Armor" parent="." index="7"]
_maxHP = 180 _maxHP = 180

View file

@ -18,10 +18,10 @@ _armor = NodePath("Armor")
material = SubResource("ShaderMaterial_sat5k") material = SubResource("ShaderMaterial_sat5k")
[node name="Hat" type="Sprite2D" parent="CanvasGroup" index="1"] [node name="Hat" type="Sprite2D" parent="CanvasGroup" index="1"]
position = Vector2(-6, -88) position = Vector2(-12, -88)
texture = ExtResource("4_qdhik") texture = ExtResource("4_qdhik")
[node name="Armor" type="Node" parent="." index="8"] [node name="Armor" type="Node" parent="." index="7"]
script = ExtResource("3_5s7in") script = ExtResource("3_5s7in")
_maxHP = 60 _maxHP = 60

View file

@ -174,12 +174,12 @@ material = SubResource("ShaderMaterial_w8pya")
[node name="Can" type="Node2D" parent="CanvasGroup" index="1"] [node name="Can" type="Node2D" parent="CanvasGroup" index="1"]
[node name="Sprite2D" type="Sprite2D" parent="CanvasGroup/Can" index="0"] [node name="Sprite2D" type="Sprite2D" parent="CanvasGroup/Can" index="0"]
position = Vector2(3, -40) position = Vector2(-4, -40)
texture = SubResource("AtlasTexture_w8pya") texture = SubResource("AtlasTexture_w8pya")
[node name="Sprite2D2" type="Sprite2D" parent="CanvasGroup/Can" index="1"] [node name="Sprite2D2" type="Sprite2D" parent="CanvasGroup/Can" index="1"]
z_index = -1 z_index = -1
position = Vector2(1, -63) position = Vector2(-6, -63)
texture = SubResource("AtlasTexture_5selg") texture = SubResource("AtlasTexture_5selg")
[node name="AnimationPlayer" parent="." index="3"] [node name="AnimationPlayer" parent="." index="3"]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=27 format=3 uid="uid://co11v3w8hbwgf"] [gd_scene load_steps=27 format=3 uid="uid://co11v3w8hbwgf"]
[ext_resource type="Script" uid="uid://dildme6epx8l4" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"] [ext_resource type="Script" uid="uid://dildme6epx8l4" path="res://scripts/components/zombies/RuntimeZombieData.cs" id="1_qq3f1"]
[ext_resource type="Texture2D" uid="uid://bwwbkybryi6k0" path="res://assets/sprites/zombie.tres" id="2_4pdxh"] [ext_resource type="Texture2D" uid="uid://bwdqbrnn7ygtr" path="res://assets/sprites/atlases/zombies/Зондби.png" id="2_4pdxh"]
[ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_srwwe"] [ext_resource type="Shader" uid="uid://d0eo5uuj222c4" path="res://assets/shaders/CG_color_blender.gdshader" id="2_srwwe"]
[ext_resource type="Script" uid="uid://dqyony6jxt2p0" path="res://scripts/components/zombies/EatBox.cs" id="3_2aulo"] [ext_resource type="Script" uid="uid://dqyony6jxt2p0" path="res://scripts/components/zombies/EatBox.cs" id="3_2aulo"]
[ext_resource type="Script" uid="uid://c5vfccegyy01t" path="res://scripts/components/FlashComponent.cs" id="3_rao3m"] [ext_resource type="Script" uid="uid://c5vfccegyy01t" path="res://scripts/components/FlashComponent.cs" id="3_rao3m"]
@ -103,7 +103,7 @@ material = SubResource("ShaderMaterial_63ls2")
script = ExtResource("3_rao3m") script = ExtResource("3_rao3m")
[node name="Sprite" type="Sprite2D" parent="CanvasGroup"] [node name="Sprite" type="Sprite2D" parent="CanvasGroup"]
position = Vector2(0, -44) position = Vector2(-4, -55)
texture = ExtResource("2_4pdxh") texture = ExtResource("2_4pdxh")
[node name="Hitbox" type="Area2D" parent="."] [node name="Hitbox" type="Area2D" parent="."]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://bes4e6sksax67"] [gd_scene load_steps=14 format=3 uid="uid://qq0cw8xtcoj3"]
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_5i0e6"] [ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_5i0e6"]
[ext_resource type="Texture2D" uid="uid://dff73m8ahamaa" path="res://assets/sprites/atlases/plants/garlic.png" id="2_w2jbi"] [ext_resource type="Texture2D" uid="uid://dff73m8ahamaa" path="res://assets/sprites/atlases/plants/garlic.png" id="2_w2jbi"]

View file

@ -3,11 +3,11 @@
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_pyk3o"] [ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_pyk3o"]
[ext_resource type="Texture2D" uid="uid://cksryh4w5dbbx" path="res://assets/sprites/atlases/plants/peashooter.png" id="2_14qlx"] [ext_resource type="Texture2D" uid="uid://cksryh4w5dbbx" path="res://assets/sprites/atlases/plants/peashooter.png" id="2_14qlx"]
[ext_resource type="AnimationLibrary" uid="uid://bv1dl1g4dmbho" path="res://resources/animations/plants/peashooter.res" id="3_8lrhp"] [ext_resource type="AnimationLibrary" uid="uid://bv1dl1g4dmbho" path="res://resources/animations/plants/peashooter.res" id="3_8lrhp"]
[ext_resource type="Script" path="res://scripts/components/plants/Shooter.cs" id="3_a4ew1"] [ext_resource type="Script" uid="uid://ceprqkraw3v6m" path="res://scripts/components/plants/Shooter.cs" id="3_a4ew1"]
[ext_resource type="PackedScene" uid="uid://b2hrv0aqbui7u" path="res://scenes/projectiles/pea.tscn" id="4_saxds"] [ext_resource type="PackedScene" uid="uid://b2hrv0aqbui7u" path="res://scenes/projectiles/pea.tscn" id="4_saxds"]
[ext_resource type="Script" path="res://scripts/components/plants/behaviours/PeashooterBehaviour.cs" id="5_7qiua"] [ext_resource type="Script" uid="uid://bdk5iqtw4xbkl" path="res://scripts/components/plants/behaviours/PeashooterBehaviour.cs" id="5_7qiua"]
[ext_resource type="Script" path="res://scripts/components/plants/Eyesight.cs" id="7_2bki8"] [ext_resource type="Script" uid="uid://dn53jvpjyg63l" path="res://scripts/components/plants/Eyesight.cs" id="7_2bki8"]
[ext_resource type="Script" path="res://scripts/components/plants/PlantEyesightLimiter.cs" id="8_nl4jc"] [ext_resource type="Script" uid="uid://hccb0aee0x0o" path="res://scripts/components/plants/PlantEyesightLimiter.cs" id="8_nl4jc"]
[sub_resource type="Animation" id="Animation_a2y0j"] [sub_resource type="Animation" id="Animation_a2y0j"]
length = 0.001 length = 0.001
@ -26,7 +26,7 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ipp6b"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_ipp6b"]
_data = { _data = {
"RESET": SubResource("Animation_a2y0j") &"RESET": SubResource("Animation_a2y0j")
} }
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_34v85"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_34v85"]
@ -68,8 +68,8 @@ vframes = 2
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
libraries = { libraries = {
"": SubResource("AnimationLibrary_ipp6b"), &"": SubResource("AnimationLibrary_ipp6b"),
"peashooter": ExtResource("3_8lrhp") &"peashooter": ExtResource("3_8lrhp")
} }
autoplay = "peashooter/idle" autoplay = "peashooter/idle"
@ -87,12 +87,10 @@ _timer = NodePath("Timer")
wait_time = 1.5 wait_time = 1.5
one_shot = true one_shot = true
[node name="Behaviour" type="Node" parent="." index="4" node_paths=PackedStringArray("_player", "_shootTimer", "_sight")] [node name="Behaviour" type="Node" parent="." index="4" node_paths=PackedStringArray("_shootTimer", "_sight")]
script = ExtResource("5_7qiua") script = ExtResource("5_7qiua")
_player = NodePath("../AnimationPlayer")
_shootTimer = NodePath("../Shooter/Timer") _shootTimer = NodePath("../Shooter/Timer")
_sight = NodePath("../Eysight") _sight = NodePath("../Eysight")
_libName = "peashooter"
[node name="Eysight" type="Area2D" parent="." index="5"] [node name="Eysight" type="Area2D" parent="." index="5"]
collision_layer = 4 collision_layer = 4

View file

@ -2,9 +2,9 @@
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_dj7ul"] [ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_dj7ul"]
[ext_resource type="Texture2D" uid="uid://c77o6ba0mw7a3" path="res://assets/sprites/atlases/plants/potato_mine.png" id="2_sneas"] [ext_resource type="Texture2D" uid="uid://c77o6ba0mw7a3" path="res://assets/sprites/atlases/plants/potato_mine.png" id="2_sneas"]
[ext_resource type="Script" path="res://scripts/components/plants/ExplosionComponent.cs" id="3_2hd5y"] [ext_resource type="Script" uid="uid://bhl6o2m3fn4xg" path="res://scripts/components/plants/ExplosionComponent.cs" id="3_2hd5y"]
[ext_resource type="AnimationLibrary" uid="uid://bjlbdvr6f0r7e" path="res://resources/animations/plants/potato_mine.res" id="3_7tqmj"] [ext_resource type="AnimationLibrary" uid="uid://bjlbdvr6f0r7e" path="res://resources/animations/plants/potato_mine.res" id="3_7tqmj"]
[ext_resource type="Script" path="res://scripts/components/plants/behaviours/PotatomineBehaviour.cs" id="4_twx65"] [ext_resource type="Script" uid="uid://c7qfh4py0uulo" path="res://scripts/components/plants/behaviours/PotatomineBehaviour.cs" id="4_twx65"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6uutc"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6uutc"]
animation = &"potato_mine/explode" animation = &"potato_mine/explode"
@ -70,10 +70,11 @@ _maxHP = 100
texture = ExtResource("2_sneas") texture = ExtResource("2_sneas")
hframes = 7 hframes = 7
vframes = 4 vframes = 4
frame = 7
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
libraries = { libraries = {
"potato_mine": ExtResource("3_7tqmj") &"potato_mine": ExtResource("3_7tqmj")
} }
autoplay = "idle_unprimed" autoplay = "idle_unprimed"

View file

@ -3,7 +3,7 @@
[ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_fluxn"] [ext_resource type="PackedScene" uid="uid://b1hjjbdwf1rtc" path="res://scenes/templates/plant_template.tscn" id="1_fluxn"]
[ext_resource type="Texture2D" uid="uid://dstqh1wc5dvmo" path="res://assets/sprites/atlases/plants/wallnut.png" id="2_o5tda"] [ext_resource type="Texture2D" uid="uid://dstqh1wc5dvmo" path="res://assets/sprites/atlases/plants/wallnut.png" id="2_o5tda"]
[ext_resource type="AnimationLibrary" uid="uid://0bdesb8j2mbo" path="res://resources/animations/plants/wallnut.res" id="3_xl65q"] [ext_resource type="AnimationLibrary" uid="uid://0bdesb8j2mbo" path="res://resources/animations/plants/wallnut.res" id="3_xl65q"]
[ext_resource type="Script" path="res://scripts/components/plants/behaviours/HpBasedBehaviour.cs" id="4_cjtyy"] [ext_resource type="Script" uid="uid://btkmd86pn828y" path="res://scripts/components/plants/behaviours/HpBasedBehaviour.cs" id="4_cjtyy"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ds5ry"] [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ds5ry"]
animation = &"wallnut/idle_full" animation = &"wallnut/idle_full"
@ -34,10 +34,11 @@ _maxHP = 1000
texture = ExtResource("2_o5tda") texture = ExtResource("2_o5tda")
hframes = 12 hframes = 12
vframes = 3 vframes = 3
frame = 3
[node name="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" parent="." index="1"]
libraries = { libraries = {
"wallnut": ExtResource("3_xl65q") &"wallnut": ExtResource("3_xl65q")
} }
[node name="AnimationTree" parent="." index="2"] [node name="AnimationTree" parent="." index="2"]

View file

@ -2,7 +2,7 @@
[ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"] [ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"]
[ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/themes/GameStyle.tres" id="1_xf6ra"] [ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/themes/GameStyle.tres" id="1_xf6ra"]
[ext_resource type="Script" path="res://scripts/components/LevelGUIElements.cs" id="2_5fonq"] [ext_resource type="Script" uid="uid://cwa1eydeiy3y4" path="res://scripts/components/LevelGUIElements.cs" id="2_5fonq"]
[ext_resource type="Texture2D" uid="uid://bbh0uwloi87tn" path="res://assets/sprites/gui/PlantPanel.png" id="2_eg3hk"] [ext_resource type="Texture2D" uid="uid://bbh0uwloi87tn" path="res://assets/sprites/gui/PlantPanel.png" id="2_eg3hk"]
[ext_resource type="PackedScene" uid="uid://t0vpmycj6c8j" path="res://scenes/gui/shovel_button.tscn" id="3_bheea"] [ext_resource type="PackedScene" uid="uid://t0vpmycj6c8j" path="res://scenes/gui/shovel_button.tscn" id="3_bheea"]
[ext_resource type="PackedScene" uid="uid://cgm7td1hgs0rr" path="res://scenes/gui/fast_forward_button.tscn" id="4_66uy4"] [ext_resource type="PackedScene" uid="uid://cgm7td1hgs0rr" path="res://scenes/gui/fast_forward_button.tscn" id="4_66uy4"]
@ -48,8 +48,8 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_myv2j"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_myv2j"]
_data = { _data = {
"RESET": SubResource("Animation_c8fnk"), &"RESET": SubResource("Animation_c8fnk"),
"flash": SubResource("Animation_ffxdv") &"flash": SubResource("Animation_ffxdv")
} }
[node name="RuntimeGUI" type="Control" node_paths=PackedStringArray("SeedpacketsHotbar", "SunCounter")] [node name="RuntimeGUI" type="Control" node_paths=PackedStringArray("SeedpacketsHotbar", "SunCounter")]
@ -134,5 +134,5 @@ metadata/_edit_lock_ = true
[node name="AnimationPlayer" type="AnimationPlayer" parent="FastForwardEffect"] [node name="AnimationPlayer" type="AnimationPlayer" parent="FastForwardEffect"]
libraries = { libraries = {
"": SubResource("AnimationLibrary_myv2j") &"": SubResource("AnimationLibrary_myv2j")
} }

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=3 uid="uid://devn21c7luf45"] [gd_scene load_steps=4 format=3 uid="uid://devn21c7luf45"]
[ext_resource type="Shader" path="res://assets/shaders/greyscale.gdshader" id="1_d73yj"] [ext_resource type="Shader" uid="uid://mt7vheq5modk" path="res://assets/shaders/greyscale.gdshader" id="1_d73yj"]
[ext_resource type="Script" path="res://scripts/components/level/PlantField.cs" id="2_84bqh"] [ext_resource type="Script" uid="uid://bj7rw2f6qu1lg" path="res://scripts/components/level/PlantField.cs" id="2_84bqh"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0miwm"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_0miwm"]
shader = ExtResource("1_d73yj") shader = ExtResource("1_d73yj")

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cg8713v6c5w15"] [gd_scene load_steps=2 format=3 uid="uid://cg8713v6c5w15"]
[ext_resource type="Script" path="res://scripts/components/level/PoolContainer.cs" id="1_31ggc"] [ext_resource type="Script" uid="uid://bso32xkw738sy" path="res://scripts/components/level/PoolContainer.cs" id="1_31ggc"]
[node name="Pools" type="Node2D" node_paths=PackedStringArray("Zombies", "Plants", "Projectiles", "Structures")] [node name="Pools" type="Node2D" node_paths=PackedStringArray("Zombies", "Plants", "Projectiles", "Structures")]
script = ExtResource("1_31ggc") script = ExtResource("1_31ggc")

View file

@ -0,0 +1,82 @@
[gd_scene load_steps=10 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"]
[ext_resource type="Script" uid="uid://bso32xkw738sy" path="res://scripts/components/level/PoolContainer.cs" id="3_6128b"]
[ext_resource type="PackedScene" uid="uid://devn21c7luf45" path="res://scenes/level components/field_controller.tscn" id="4_ibntj"]
[ext_resource type="PackedScene" uid="uid://cfnmspei3k4p7" path="res://scenes/gui/runtime_gui.tscn" id="5_iotae"]
[ext_resource type="PackedScene" uid="uid://dpxxjfd5lv5sv" path="res://scenes/gui/choose_your_seeds.tscn" id="6_btfw3"]
[ext_resource type="Script" uid="uid://cslqjdd5wq4rc" path="res://scripts/components/level/SunSpawner.cs" id="7_gnb05"]
[ext_resource type="PackedScene" uid="uid://bpekho7leatr5" path="res://scenes/sun.tscn" id="8_8nyym"]
[ext_resource type="Script" uid="uid://bsuw5lvnr3kol" path="res://scripts/components/level/zombe_spawners/ZombieSequencer.cs" id="9_8nyym"]
[node name="PrototypeSurvival" type="Node2D"]
[node name="Data" type="Node" parent="."]
script = ExtResource("1_tnxdx")
SunCount = 50
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(500, 200)
texture = ExtResource("1_vafkg")
metadata/_edit_lock_ = true
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(481, 200)
metadata/_edit_lock_ = true
[node name="Pools" type="Node2D" parent="." node_paths=PackedStringArray("Zombies", "Plants", "Projectiles", "Structures")]
script = ExtResource("3_6128b")
Zombies = NodePath("Zombies")
Plants = NodePath("Plants")
Projectiles = NodePath("Projectiles")
Structures = NodePath("Structures")
[node name="Zombies" type="Node2D" parent="Pools"]
z_index = 3
y_sort_enabled = true
[node name="Plants" type="Node2D" parent="Pools"]
z_index = 1
y_sort_enabled = true
[node name="Projectiles" type="Node2D" parent="Pools"]
z_index = 4
y_sort_enabled = true
[node name="Structures" type="Node2D" parent="Pools"]
z_index = 2
y_sort_enabled = true
[node name="Overlay" type="CanvasLayer" parent="."]
layer = 6
follow_viewport_enabled = true
[node name="FieldController" parent="Overlay" instance=ExtResource("4_ibntj")]
[node name="GUI" type="CanvasLayer" parent="."]
layer = 10
[node name="RuntimeGUI" parent="GUI" instance=ExtResource("5_iotae")]
metadata/_edit_lock_ = true
[node name="ChooseYourSeeds" parent="GUI" instance=ExtResource("6_btfw3")]
metadata/_edit_lock_ = true
[node name="SunSpawner" type="Node" parent="."]
script = ExtResource("7_gnb05")
SunScene = ExtResource("8_8nyym")
[node name="Timer" type="Timer" parent="SunSpawner"]
wait_time = 15.0
[node name="ZombieSequencer" type="Node2D" parent="."]
position = Vector2(823, 0)
script = ExtResource("9_8nyym")
[node name="Timer" type="Timer" parent="ZombieSequencer"]
wait_time = 5.0
autostart = true
[connection signal="timeout" from="SunSpawner/Timer" to="SunSpawner" method="Spawn"]
[connection signal="timeout" from="ZombieSequencer/Timer" to="ZombieSequencer" method="FormSquad"]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=13 format=3 uid="uid://bpekho7leatr5"] [gd_scene load_steps=13 format=3 uid="uid://bpekho7leatr5"]
[ext_resource type="Shader" path="res://assets/shaders/shared_outline.gdshader" id="1_jcu1f"] [ext_resource type="Shader" uid="uid://bk8uy5se3fo0" path="res://assets/shaders/shared_outline.gdshader" id="1_jcu1f"]
[ext_resource type="Script" path="res://scripts/Sun.cs" id="2_m8xcj"] [ext_resource type="Script" uid="uid://qgeovvluk8yj" path="res://scripts/Sun.cs" id="2_m8xcj"]
[ext_resource type="Texture2D" uid="uid://bkmphus5wjadi" path="res://assets/sprites/atlases/sun_atlas.png" id="2_phn3y"] [ext_resource type="Texture2D" uid="uid://bkmphus5wjadi" path="res://assets/sprites/atlases/sun_atlas.png" id="2_phn3y"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_u0o5k"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_u0o5k"]
@ -73,8 +73,8 @@ tracks/1/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_juv2v"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_juv2v"]
_data = { _data = {
"RESET": SubResource("Animation_jfrge"), &"RESET": SubResource("Animation_jfrge"),
"main": SubResource("Animation_rvj0j") &"main": SubResource("Animation_rvj0j")
} }
[sub_resource type="Animation" id="Animation_t53pt"] [sub_resource type="Animation" id="Animation_t53pt"]
@ -108,8 +108,8 @@ tracks/0/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_p7c0n"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_p7c0n"]
_data = { _data = {
"RESET": SubResource("Animation_t53pt"), &"RESET": SubResource("Animation_t53pt"),
"main": SubResource("Animation_xyill") &"main": SubResource("Animation_xyill")
} }
[sub_resource type="CircleShape2D" id="CircleShape2D_7hl7x"] [sub_resource type="CircleShape2D" id="CircleShape2D_7hl7x"]
@ -144,13 +144,13 @@ frame = 2
[node name="RotationAnimation" type="AnimationPlayer" parent="."] [node name="RotationAnimation" type="AnimationPlayer" parent="."]
libraries = { libraries = {
"": SubResource("AnimationLibrary_juv2v") &"": SubResource("AnimationLibrary_juv2v")
} }
autoplay = "main" autoplay = "main"
[node name="FadeAnimation" type="AnimationPlayer" parent="."] [node name="FadeAnimation" type="AnimationPlayer" parent="."]
libraries = { libraries = {
"": SubResource("AnimationLibrary_p7c0n") &"": SubResource("AnimationLibrary_p7c0n")
} }
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View file

@ -0,0 +1,69 @@
using Godot;
using System.Linq;
using System.Collections.Generic;
public partial class DebugZombieSpawner : PopupPanel
{
private List<string> variants;
[Export] private Label label;
[Export] private LineEdit line;
[Export] private SpinBox spin;
public void OnTextChanged(string text)
{
variants = GameRegistry.GetZombieNames();
variants.Sort(Comparer);
if (variants.Count > 3)
{
label.Text = $"{variants[0]}\n{variants[1]}\n{variants[2]}";
}
else
{
label.Text = "";
for (int i = 0; i < variants.Count; i++)
{
label.Text += variants[i] + "\n";
}
}
}
public void OnTextSubmitted(string text)
{
spin.GrabFocus();
}
public void OnPopupHide()
{
if (variants == null || variants.Count == 0)
{
return;
}
for(int i = 0; i < spin.Value; i++)
{
ZombieSequencer.Instance.Add(variants[0]);
}
QueueFree();
}
private int Comparer(string x, string y)
{
return LevensteinDistance(x,line.Text) - LevensteinDistance(y,line.Text);
}
private static int LevensteinDistance(string a, string b)
{
if (b.Length == 0)
{
return a.Length;
}
else if (a.Length == 0)
{
return b.Length;
}
else if (a[0] == b[0])
{
return LevensteinDistance(a[1..], b[1..]);
}
List<int> x = [LevensteinDistance(a[1..], b[1..]), LevensteinDistance(a[1..], b), LevensteinDistance(a, b[1..])];
return 1 + x.Min();
}
}

View file

@ -0,0 +1 @@
uid://dac0bvlhho7u4

View file

@ -12,19 +12,13 @@ public partial class GridLoader : GridContainer
{ {
_plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn"); _plantCard = ResourceLoader.Load<PackedScene>("res://scenes/gui/seedpacket.tscn");
string[] files = DirAccess.GetFilesAt(PLANT_RESOURCE_PATH); foreach(var resource in GameRegistry.GetPlants())
foreach(var file in files)
{ {
if(ResourceLoader.Exists(PLANT_RESOURCE_PATH+file)) Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
{ AddChild(slot);
Seedpacket slot = _plantCard.Instantiate<Seedpacket>();
AddChild(slot); slot.SetPlantResource(resource);
slot.SetHandler(new ChoosableHandler(slot));
slot.SetPlantResource(ResourceLoader.Load<PlantResource>(PLANT_RESOURCE_PATH+file));
slot.SetHandler(new ChoosableHandler(slot));
}
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace Newlon.Components.Level;
// Is not pool in traditional sense, but named like that to prevent repetition // Is not pool in traditional sense, but named like that to prevent repetition
// //
public partial class PoolContainer : Node public partial class PoolContainer : Node2D
{ {
[Export] [Export]
public Node2D Zombies { get; private set; } public Node2D Zombies { get; private set; }

View file

@ -0,0 +1,63 @@
using System.Collections.Generic;
using Godot;
using Newlon;
using Newlon.Components.Level;
using Newlon.Components.Zombies;
public partial class ZombieSequencer : Node2D
{
public static ZombieSequencer Instance { get; private set; }
private Queue<string> queue = [];
private RandomNumberGenerator rng = new();
public override void _Ready()
{
rng.Randomize();
Instance = this;
}
private void FormSquad()
{
if (queue.Count == 0) return;
int count = rng.RandiRange(1, queue.Count > 5 ? 5 : queue.Count);
if (count == 5)
{
Spawn(queue.Dequeue(), 1);
Spawn(queue.Dequeue(), 2);
Spawn(queue.Dequeue(), 3);
Spawn(queue.Dequeue(), 4);
Spawn(queue.Dequeue(), 5);
}
List<int> list = [];
while (list.Count < count)
{
int lane = rng.RandiRange(1, 5);
if (list.Contains(lane) == true)
{
continue;
}
list.Add(lane);
}
foreach (int lane in list)
{
Spawn(queue.Dequeue(), lane);
}
}
private void Spawn(string id, int lane)
{
RuntimeZombieData zombie = GameRegistry.GetZombieByName(id).scene.Instantiate<RuntimeZombieData>();
PoolContainer.Instance.Zombies.AddChild(zombie);
zombie.GlobalPosition = new Vector2(GlobalPosition.X, Utility.RightFieldBoundary.Y - (lane-1) * Utility.TileHeight);
}
public void Add(string id)
{
queue.Enqueue(id);
}
}

View file

@ -0,0 +1 @@
uid://bsuw5lvnr3kol

View file

@ -4,7 +4,7 @@ namespace Newlon.Components.Plants;
public partial class PlantEyesightLimiter : CollisionShape2D public partial class PlantEyesightLimiter : CollisionShape2D
{ {
public override void _Ready() public override void _Process(double delta)
{ {
if (Shape is SegmentShape2D segment) if (Shape is SegmentShape2D segment)
{ {

View file

@ -37,7 +37,6 @@ public partial class AloeBehaviour : BaseBehaviour
if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData)) if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData))
{ {
plantData.Heal(3000 + 25 * plantData.MaxHp, GetParent()); plantData.Heal(3000 + 25 * plantData.MaxHp, GetParent());
GD.Print("IM TRYING");
} }
} }

View file

@ -25,7 +25,6 @@ public partial class EatBox : Area2D
public void OnAreaEntered(Area2D area) public void OnAreaEntered(Area2D area)
{ {
var parent = area.GetParent(); var parent = area.GetParent();
GD.Print(parent.Name);
if (parent != null && parent is RuntimePlantData plantData) if (parent != null && parent is RuntimePlantData plantData)
{ {

View file

@ -21,7 +21,6 @@ public partial class ZombieMover : Node
* Utility.TileWidth * Utility.TileWidth
* GetParent<RuntimeZombieData>().LocalTimescale * GetParent<RuntimeZombieData>().LocalTimescale
* _speed.GetValue(); * _speed.GetValue();
GD.Print(_speed.GetMult());
} }
public void SetSpeedFlat(float speed) public void SetSpeedFlat(float speed)

View file

@ -12,5 +12,11 @@ public partial class Cheats : Node
{ {
RuntimeLevelData.Instance.AddSun(50); RuntimeLevelData.Instance.AddSun(50);
} }
if (@event.IsActionPressed("cheat_zombie_spawn"))
{
var spawner = GD.Load<PackedScene>("res://scenes/debug_zombie_spawner.tscn").Instantiate<DebugZombieSpawner>();
GetTree().CurrentScene.AddChild(spawner);
}
} }
} }

View file

@ -0,0 +1,8 @@
using Godot;
[GlobalClass]
public partial class ZombieResource : Resource
{
[Export] public int cost;
[Export] public PackedScene scene;
}

View file

@ -0,0 +1 @@
uid://cqxj7o8hdm82n

View file

@ -0,0 +1,91 @@
using Godot;
using Newlon;
using System.Collections.Generic;
public partial class GameRegistry : Node
{
private const string PLANT_RESOURCE_PATH = "res://resources/plants/";
private const string ZOMBIE_RESOURCE_PATH = "res://resources/zombies/";
public static GameRegistry Instance { get; private set; }
private Dictionary<string, PlantResource> PlantDictionary = [];
private Dictionary<string, ZombieResource> ZombieDictionary = [];
public override void _Ready()
{
Instance = this;
//Plant init
string[] plantFiles = DirAccess.GetFilesAt(PLANT_RESOURCE_PATH);
foreach (var file in plantFiles)
{
if (ResourceLoader.Exists(PLANT_RESOURCE_PATH + file))
{
var plant = ResourceLoader.Load<PlantResource>(PLANT_RESOURCE_PATH + file);
PlantDictionary.Add(file.ToLower().Split('.')[0], plant);
}
}
//Zombie init
string[] zombieFiles = DirAccess.GetFilesAt(ZOMBIE_RESOURCE_PATH);
foreach (var file in zombieFiles)
{
if (ResourceLoader.Exists(ZOMBIE_RESOURCE_PATH + file))
{
var zombie = ResourceLoader.Load<ZombieResource>(ZOMBIE_RESOURCE_PATH + file);
ZombieDictionary.Add(file.ToLower().Split('.')[0], zombie);
}
}
}
public static PlantResource GetPlantByName(string name)
{
if (Instance.PlantDictionary.ContainsKey(name) == false) return null;
return Instance.PlantDictionary[name];
}
public static List<string> GetPlantNames()
{
List<string> result = [];
foreach (var key in Instance.PlantDictionary.Keys)
{
result.Add(key);
}
return result;
}
public static List<PlantResource> GetPlants()
{
List<PlantResource> result = [];
foreach (var value in Instance.PlantDictionary.Values)
{
result.Add(value);
}
return result;
}
public static ZombieResource GetZombieByName(string name)
{
if (Instance.ZombieDictionary.ContainsKey(name) == false) return null;
return Instance.ZombieDictionary[name];
}
public static List<string> GetZombieNames()
{
List<string> result = [];
foreach (var key in Instance.ZombieDictionary.Keys)
{
result.Add(key);
}
return result;
}
public static List<ZombieResource> GetZombies()
{
List<ZombieResource> result = [];
foreach (var value in Instance.ZombieDictionary.Values)
{
result.Add(value);
}
return result;
}
}

View file

@ -0,0 +1 @@
uid://b66j681wn5tjn