diff --git a/assets/sprites/atlases/atlas1.png b/assets/sprites/atlases/atlas1.png index da6a360..58c7f1a 100644 Binary files a/assets/sprites/atlases/atlas1.png and b/assets/sprites/atlases/atlas1.png differ diff --git a/assets/sprites/atlases/atlas2.png b/assets/sprites/atlases/atlas2.png new file mode 100644 index 0000000..4f2a2ad Binary files /dev/null and b/assets/sprites/atlases/atlas2.png differ diff --git a/assets/sprites/atlases/atlas2.png.import b/assets/sprites/atlases/atlas2.png.import new file mode 100644 index 0000000..fd870f8 --- /dev/null +++ b/assets/sprites/atlases/atlas2.png.import @@ -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 diff --git a/assets/sprites/gui/ButtonBackground.tres b/assets/sprites/gui/ButtonBackground.tres index 894b3d3..ebf162f 100644 --- a/assets/sprites/gui/ButtonBackground.tres +++ b/assets/sprites/gui/ButtonBackground.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_i6oyj") -region = Rect2(0, 300, 36, 36) +region = Rect2(177, 40, 36, 36) diff --git a/assets/sprites/gui/ChooseYourSeeds/FrameField.tres b/assets/sprites/gui/ChooseYourSeeds/FrameField.tres index 8dd131a..d04d0b7 100644 --- a/assets/sprites/gui/ChooseYourSeeds/FrameField.tres +++ b/assets/sprites/gui/ChooseYourSeeds/FrameField.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_es82j") -region = Rect2(115, 300, 65, 65) +region = Rect2(296, 0, 65, 65) diff --git a/assets/sprites/gui/ChooseYourSeeds/Grabber.tres b/assets/sprites/gui/ChooseYourSeeds/Grabber.tres index 8770209..9552558 100644 --- a/assets/sprites/gui/ChooseYourSeeds/Grabber.tres +++ b/assets/sprites/gui/ChooseYourSeeds/Grabber.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_bv8ko") -region = Rect2(113, 414, 15, 32) +region = Rect2(270, 77, 15, 32) diff --git a/assets/sprites/gui/ChooseYourSeeds/InnerPanel.tres b/assets/sprites/gui/ChooseYourSeeds/InnerPanel.tres index 7f72826..61831dd 100644 --- a/assets/sprites/gui/ChooseYourSeeds/InnerPanel.tres +++ b/assets/sprites/gui/ChooseYourSeeds/InnerPanel.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_vi2yj") -region = Rect2(113, 402, 14, 12) +region = Rect2(296, 65, 14, 12) diff --git a/assets/sprites/gui/ChooseYourSeeds/LevelRun.tres b/assets/sprites/gui/ChooseYourSeeds/LevelRun.tres index 4f75580..4dcd26d 100644 --- a/assets/sprites/gui/ChooseYourSeeds/LevelRun.tres +++ b/assets/sprites/gui/ChooseYourSeeds/LevelRun.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_wytrb") -region = Rect2(87, 382, 41, 20) +region = Rect2(512, 221, 41, 20) diff --git a/assets/sprites/gui/ChooseYourSeeds/Panel.tres b/assets/sprites/gui/ChooseYourSeeds/Panel.tres index 63b22d1..0b987e1 100644 --- a/assets/sprites/gui/ChooseYourSeeds/Panel.tres +++ b/assets/sprites/gui/ChooseYourSeeds/Panel.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_ugykr") -region = Rect2(87, 402, 26, 27) +region = Rect2(244, 77, 26, 27) diff --git a/assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres b/assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres index 45d5200..c9ee1aa 100644 --- a/assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres +++ b/assets/sprites/gui/ChooseYourSeeds/PlantFrame.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_44qhk") -region = Rect2(38, 300, 77, 77) +region = Rect2(219, 0, 77, 77) diff --git a/assets/sprites/gui/ChooseYourSeeds/Slider.tres b/assets/sprites/gui/ChooseYourSeeds/Slider.tres index fe971a7..3ac3137 100644 --- a/assets/sprites/gui/ChooseYourSeeds/Slider.tres +++ b/assets/sprites/gui/ChooseYourSeeds/Slider.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_auh61") -region = Rect2(129, 401, 13, 13) +region = Rect2(285, 77, 13, 13) diff --git a/assets/sprites/gui/EmptyShovel.tres b/assets/sprites/gui/EmptyShovel.tres index 99dbd9e..0fee8b1 100644 --- a/assets/sprites/gui/EmptyShovel.tres +++ b/assets/sprites/gui/EmptyShovel.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_i8m7w") -region = Rect2(341, 67, 51, 47) +region = Rect2(0, 174, 46, 46) diff --git a/assets/sprites/gui/FastForward1.tres b/assets/sprites/gui/FastForward1.tres index 97b2140..ecd8ce8 100644 --- a/assets/sprites/gui/FastForward1.tres +++ b/assets/sprites/gui/FastForward1.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_r6k0p") -region = Rect2(45, 272, 18, 20) +region = Rect2(571, 221, 18, 20) diff --git a/assets/sprites/gui/FastForward2.tres b/assets/sprites/gui/FastForward2.tres index 90fb247..a4c2fd8 100644 --- a/assets/sprites/gui/FastForward2.tres +++ b/assets/sprites/gui/FastForward2.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_cq0f1") -region = Rect2(81, 272, 18, 20) +region = Rect2(589, 221, 18, 20) diff --git a/assets/sprites/gui/FastForward3.tres b/assets/sprites/gui/FastForward3.tres index b8b9065..6cac34a 100644 --- a/assets/sprites/gui/FastForward3.tres +++ b/assets/sprites/gui/FastForward3.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_xsjda") -region = Rect2(117, 272, 18, 20) +region = Rect2(607, 221, 18, 20) diff --git a/assets/sprites/gui/Pause.tres b/assets/sprites/gui/Pause.tres index fa448d9..b1bf3dc 100644 --- a/assets/sprites/gui/Pause.tres +++ b/assets/sprites/gui/Pause.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_qlv5m") -region = Rect2(9, 272, 18, 20) +region = Rect2(553, 221, 18, 20) diff --git a/assets/sprites/gui/Selection.tres b/assets/sprites/gui/Selection.tres index aabf63f..efcf2ff 100644 --- a/assets/sprites/gui/Selection.tres +++ b/assets/sprites/gui/Selection.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_safs8") -region = Rect2(300, 60, 41, 56) +region = Rect2(514, 65, 41, 56) diff --git a/assets/sprites/gui/SelectionGeneric.tres b/assets/sprites/gui/SelectionGeneric.tres index e208465..a4ae600 100644 --- a/assets/sprites/gui/SelectionGeneric.tres +++ b/assets/sprites/gui/SelectionGeneric.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_sqfv1") -region = Rect2(156, 365, 25, 25) +region = Rect2(514, 65, 41, 56) diff --git a/assets/sprites/gui/Shovel.tres b/assets/sprites/gui/Shovel.tres index 3ccba3b..8c78421 100644 --- a/assets/sprites/gui/Shovel.tres +++ b/assets/sprites/gui/Shovel.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_s2rs0") -region = Rect2(0, 145, 51, 47) +region = Rect2(46, 174, 51, 47) diff --git a/assets/sprites/gui/pause_bg.tres b/assets/sprites/gui/pause_bg.tres new file mode 100644 index 0000000..416d5da --- /dev/null +++ b/assets/sprites/gui/pause_bg.tres @@ -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) diff --git a/assets/sprites/gui/suncounter.tres b/assets/sprites/gui/suncounter.tres index cae461d..dd0c343 100644 --- a/assets/sprites/gui/suncounter.tres +++ b/assets/sprites/gui/suncounter.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_deojb") -region = Rect2(80, 120, 49, 27) +region = Rect2(177, 77, 49, 27) diff --git a/assets/sprites/plants/Spikeweed.tres b/assets/sprites/plants/Spikeweed.tres index 9875f64..080c189 100644 --- a/assets/sprites/plants/Spikeweed.tres +++ b/assets/sprites/plants/Spikeweed.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_h51va") -region = Rect2(201, 37, 49, 22) +region = Rect2(170, 241, 48, 22) diff --git a/assets/sprites/plants/Wallnut.tres b/assets/sprites/plants/Wallnut.tres index 7a875b3..3de1b22 100644 --- a/assets/sprites/plants/Wallnut.tres +++ b/assets/sprites/plants/Wallnut.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_rqu4e") -region = Rect2(104, 12, 41, 46) +region = Rect2(84, 241, 41, 46) diff --git a/assets/sprites/plants/aloe.tres b/assets/sprites/plants/aloe.tres index 688673b..92f93aa 100644 --- a/assets/sprites/plants/aloe.tres +++ b/assets/sprites/plants/aloe.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_rq51o") -region = Rect2(302, 6, 52, 50) +region = Rect2(262, 241, 52, 50) diff --git a/assets/sprites/plants/garlic.tres b/assets/sprites/plants/garlic.tres index af97d2a..6c99598 100644 --- a/assets/sprites/plants/garlic.tres +++ b/assets/sprites/plants/garlic.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_el55x") -region = Rect2(356, 16, 39, 41) +region = Rect2(314, 241, 39, 41) diff --git a/assets/sprites/plants/pea.tres b/assets/sprites/plants/pea.tres index 685e585..7571683 100644 --- a/assets/sprites/plants/pea.tres +++ b/assets/sprites/plants/pea.tres @@ -1,7 +1,7 @@ [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] -atlas = ExtResource("1_soyv1") -region = Rect2(2, 130, 12, 12) +atlas = ExtResource("1_l6gbe") +region = Rect2(0, 88, 12, 12) diff --git a/assets/sprites/plants/peashooter.tres b/assets/sprites/plants/peashooter.tres index f32f59d..42cd8e3 100644 --- a/assets/sprites/plants/peashooter.tres +++ b/assets/sprites/plants/peashooter.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_vhxkc") -region = Rect2(1, 10, 42, 48) +region = Rect2(0, 241, 42, 48) diff --git a/assets/sprites/plants/potatomine.tres b/assets/sprites/plants/potatomine.tres index 933736f..8e504ca 100644 --- a/assets/sprites/plants/potatomine.tres +++ b/assets/sprites/plants/potatomine.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_qntd0") -region = Rect2(153, 17, 45, 42) +region = Rect2(125, 241, 45, 42) diff --git a/assets/sprites/plants/snowpea.tres b/assets/sprites/plants/snowpea.tres index e26344f..694809a 100644 --- a/assets/sprites/plants/snowpea.tres +++ b/assets/sprites/plants/snowpea.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_pt3id") -region = Rect2(253, 5, 43, 54) +region = Rect2(219, 241, 43, 54) diff --git a/assets/sprites/plants/snowpea_projectile.tres b/assets/sprites/plants/snowpea_projectile.tres index dd33464..9977fb4 100644 --- a/assets/sprites/plants/snowpea_projectile.tres +++ b/assets/sprites/plants/snowpea_projectile.tres @@ -1,7 +1,7 @@ [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] -atlas = ExtResource("1_ljncc") -region = Rect2(18, 130, 12, 12) +atlas = ExtResource("1_kbnyt") +region = Rect2(12, 88, 12, 12) diff --git a/assets/sprites/plants/sunflower.tres b/assets/sprites/plants/sunflower.tres index 9a974ee..edfba46 100644 --- a/assets/sprites/plants/sunflower.tres +++ b/assets/sprites/plants/sunflower.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_x8dof") -region = Rect2(54, 3, 42, 56) +region = Rect2(42, 241, 42, 56) diff --git a/assets/sprites/sun.tres b/assets/sprites/sun.tres index 4cc9c24..0eea91e 100644 --- a/assets/sprites/sun.tres +++ b/assets/sprites/sun.tres @@ -4,4 +4,4 @@ [resource] atlas = ExtResource("1_wwp2c") -region = Rect2(84, 147, 45, 45) +region = Rect2(177, 104, 45, 45) diff --git a/project.godot b/project.godot index 0493d5c..f4e5722 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] 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/icon="res://icon.png" config/windows_native_icon="res://icon.ico" @@ -20,6 +20,8 @@ config/windows_native_icon="res://icon.ico" LevelController="*res://scripts/LevelController.cs" Cursor="*res://scripts/Cursor.cs" +GameRegistry="*res://scripts/systems/GameRegistry.cs" +Cheats="*res://scripts/debug/Cheats.cs" [display] @@ -32,11 +34,16 @@ window/per_pixel_transparency/allowed=true project/assembly_name="NewLON" +[editor_plugins] + +enabled=PackedStringArray("res://addons/floatmodifiers/plugin.cfg") + [file_customization] folder_colors={ "res://assets/sprites/atlases/plants/": "green", "res://resources/plants/": "green", +"res://scenes/": "red", "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) ] } +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] diff --git a/resources/animations/plants/snowpea.res b/resources/animations/plants/snowpea.res index 2bb2ac0..41ea17c 100644 Binary files a/resources/animations/plants/snowpea.res and b/resources/animations/plants/snowpea.res differ diff --git a/resources/animations/plants/wallnut.res b/resources/animations/plants/wallnut.res index 4dd4261..f3d5a5b 100644 Binary files a/resources/animations/plants/wallnut.res and b/resources/animations/plants/wallnut.res differ diff --git a/resources/zombies/basic.tres b/resources/zombies/basic.tres new file mode 100644 index 0000000..e26d47f --- /dev/null +++ b/resources/zombies/basic.tres @@ -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" diff --git a/resources/zombies/buckethead.tres b/resources/zombies/buckethead.tres new file mode 100644 index 0000000..6971f02 --- /dev/null +++ b/resources/zombies/buckethead.tres @@ -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" diff --git a/resources/zombies/conehead.tres b/resources/zombies/conehead.tres new file mode 100644 index 0000000..8e9bc33 --- /dev/null +++ b/resources/zombies/conehead.tres @@ -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" diff --git a/resources/zombies/hobo.tres b/resources/zombies/hobo.tres new file mode 100644 index 0000000..309bb06 --- /dev/null +++ b/resources/zombies/hobo.tres @@ -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" diff --git a/scenes/debug_lvl.tscn b/scenes/debug_lvl.tscn index b4cbd8e..d3fb90c 100644 --- a/scenes/debug_lvl.tscn +++ b/scenes/debug_lvl.tscn @@ -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="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://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://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://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"] +y_sort_enabled = true [node name="SummertimeSaga" type="Sprite2D" parent="."] +z_index = -4096 +z_as_relative = false position = Vector2(500, 200) texture = ExtResource("2_vmxhy") metadata/_edit_lock_ = true @@ -26,7 +27,28 @@ metadata/_edit_lock_ = true script = ExtResource("1_i3bf5") 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="."] layer = 10 @@ -50,10 +72,4 @@ SunScene = ExtResource("6_ay12k") wait_time = 5.0 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"] diff --git a/scenes/debug_zombie_spawner.tscn b/scenes/debug_zombie_spawner.tscn new file mode 100644 index 0000000..5026776 --- /dev/null +++ b/scenes/debug_zombie_spawner.tscn @@ -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"] diff --git a/scenes/entities/Zombies/bucket_zombie.tscn b/scenes/entities/Zombies/bucket_zombie.tscn index 7464be8..473b39f 100644 --- a/scenes/entities/Zombies/bucket_zombie.tscn +++ b/scenes/entities/Zombies/bucket_zombie.tscn @@ -16,8 +16,8 @@ shader_parameter/amount = 0.0 material = SubResource("ShaderMaterial_wdi07") [node name="Hat" parent="CanvasGroup" index="1"] -position = Vector2(-7, -83) +position = Vector2(-12, -83) texture = ExtResource("3_0nlp0") -[node name="Armor" parent="." index="8"] +[node name="Armor" parent="." index="7"] _maxHP = 180 diff --git a/scenes/entities/Zombies/cone_zombie.tscn b/scenes/entities/Zombies/cone_zombie.tscn index 54dcaaa..e8588de 100644 --- a/scenes/entities/Zombies/cone_zombie.tscn +++ b/scenes/entities/Zombies/cone_zombie.tscn @@ -18,10 +18,10 @@ _armor = NodePath("Armor") material = SubResource("ShaderMaterial_sat5k") [node name="Hat" type="Sprite2D" parent="CanvasGroup" index="1"] -position = Vector2(-6, -88) +position = Vector2(-12, -88) texture = ExtResource("4_qdhik") -[node name="Armor" type="Node" parent="." index="8"] +[node name="Armor" type="Node" parent="." index="7"] script = ExtResource("3_5s7in") _maxHP = 60 diff --git a/scenes/entities/Zombies/hobo.tscn b/scenes/entities/Zombies/hobo.tscn index 45f26a4..390f5e1 100644 --- a/scenes/entities/Zombies/hobo.tscn +++ b/scenes/entities/Zombies/hobo.tscn @@ -174,12 +174,12 @@ material = SubResource("ShaderMaterial_w8pya") [node name="Can" type="Node2D" parent="CanvasGroup" index="1"] [node name="Sprite2D" type="Sprite2D" parent="CanvasGroup/Can" index="0"] -position = Vector2(3, -40) +position = Vector2(-4, -40) texture = SubResource("AtlasTexture_w8pya") [node name="Sprite2D2" type="Sprite2D" parent="CanvasGroup/Can" index="1"] z_index = -1 -position = Vector2(1, -63) +position = Vector2(-6, -63) texture = SubResource("AtlasTexture_5selg") [node name="AnimationPlayer" parent="." index="3"] diff --git a/scenes/entities/Zombies/zombie.tscn b/scenes/entities/Zombies/zombie.tscn index fdbe125..d14e135 100644 --- a/scenes/entities/Zombies/zombie.tscn +++ b/scenes/entities/Zombies/zombie.tscn @@ -1,7 +1,7 @@ [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="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="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"] @@ -103,7 +103,7 @@ material = SubResource("ShaderMaterial_63ls2") script = ExtResource("3_rao3m") [node name="Sprite" type="Sprite2D" parent="CanvasGroup"] -position = Vector2(0, -44) +position = Vector2(-4, -55) texture = ExtResource("2_4pdxh") [node name="Hitbox" type="Area2D" parent="."] diff --git a/scenes/entities/plants/garlic.tscn b/scenes/entities/plants/garlic.tscn index 15c9b6e..338c16f 100644 --- a/scenes/entities/plants/garlic.tscn +++ b/scenes/entities/plants/garlic.tscn @@ -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="Texture2D" uid="uid://dff73m8ahamaa" path="res://assets/sprites/atlases/plants/garlic.png" id="2_w2jbi"] diff --git a/scenes/entities/plants/peashooter.tscn b/scenes/entities/plants/peashooter.tscn index 6eb42fb..dd01d96 100644 --- a/scenes/entities/plants/peashooter.tscn +++ b/scenes/entities/plants/peashooter.tscn @@ -3,11 +3,11 @@ [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="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="Script" 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" path="res://scripts/components/plants/PlantEyesightLimiter.cs" id="8_nl4jc"] +[ext_resource type="Script" uid="uid://bdk5iqtw4xbkl" path="res://scripts/components/plants/behaviours/PeashooterBehaviour.cs" id="5_7qiua"] +[ext_resource type="Script" uid="uid://dn53jvpjyg63l" path="res://scripts/components/plants/Eyesight.cs" id="7_2bki8"] +[ext_resource type="Script" uid="uid://hccb0aee0x0o" path="res://scripts/components/plants/PlantEyesightLimiter.cs" id="8_nl4jc"] [sub_resource type="Animation" id="Animation_a2y0j"] length = 0.001 @@ -26,7 +26,7 @@ tracks/0/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_ipp6b"] _data = { -"RESET": SubResource("Animation_a2y0j") +&"RESET": SubResource("Animation_a2y0j") } [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_34v85"] @@ -68,8 +68,8 @@ vframes = 2 [node name="AnimationPlayer" parent="." index="1"] libraries = { -"": SubResource("AnimationLibrary_ipp6b"), -"peashooter": ExtResource("3_8lrhp") +&"": SubResource("AnimationLibrary_ipp6b"), +&"peashooter": ExtResource("3_8lrhp") } autoplay = "peashooter/idle" @@ -87,12 +87,10 @@ _timer = NodePath("Timer") wait_time = 1.5 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") -_player = NodePath("../AnimationPlayer") _shootTimer = NodePath("../Shooter/Timer") _sight = NodePath("../Eysight") -_libName = "peashooter" [node name="Eysight" type="Area2D" parent="." index="5"] collision_layer = 4 diff --git a/scenes/entities/plants/potato_mine.tscn b/scenes/entities/plants/potato_mine.tscn index 7f0e2a2..88b75d9 100644 --- a/scenes/entities/plants/potato_mine.tscn +++ b/scenes/entities/plants/potato_mine.tscn @@ -2,9 +2,9 @@ [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="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="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"] animation = &"potato_mine/explode" @@ -70,10 +70,11 @@ _maxHP = 100 texture = ExtResource("2_sneas") hframes = 7 vframes = 4 +frame = 7 [node name="AnimationPlayer" parent="." index="1"] libraries = { -"potato_mine": ExtResource("3_7tqmj") +&"potato_mine": ExtResource("3_7tqmj") } autoplay = "idle_unprimed" diff --git a/scenes/entities/plants/wallnut.tscn b/scenes/entities/plants/wallnut.tscn index 72d177e..35a0a56 100644 --- a/scenes/entities/plants/wallnut.tscn +++ b/scenes/entities/plants/wallnut.tscn @@ -3,7 +3,7 @@ [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="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"] animation = &"wallnut/idle_full" @@ -34,10 +34,11 @@ _maxHP = 1000 texture = ExtResource("2_o5tda") hframes = 12 vframes = 3 +frame = 3 [node name="AnimationPlayer" parent="." index="1"] libraries = { -"wallnut": ExtResource("3_xl65q") +&"wallnut": ExtResource("3_xl65q") } [node name="AnimationTree" parent="." index="2"] diff --git a/scenes/gui/runtime_gui.tscn b/scenes/gui/runtime_gui.tscn index 5297503..2fe6d95 100644 --- a/scenes/gui/runtime_gui.tscn +++ b/scenes/gui/runtime_gui.tscn @@ -2,7 +2,7 @@ [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="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="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"] @@ -48,8 +48,8 @@ tracks/0/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_myv2j"] _data = { -"RESET": SubResource("Animation_c8fnk"), -"flash": SubResource("Animation_ffxdv") +&"RESET": SubResource("Animation_c8fnk"), +&"flash": SubResource("Animation_ffxdv") } [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"] libraries = { -"": SubResource("AnimationLibrary_myv2j") +&"": SubResource("AnimationLibrary_myv2j") } diff --git a/scenes/level components/field_controller.tscn b/scenes/level components/field_controller.tscn index ab06bf3..ac09786 100644 --- a/scenes/level components/field_controller.tscn +++ b/scenes/level components/field_controller.tscn @@ -1,7 +1,7 @@ [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="Script" path="res://scripts/components/level/PlantField.cs" id="2_84bqh"] +[ext_resource type="Shader" uid="uid://mt7vheq5modk" path="res://assets/shaders/greyscale.gdshader" id="1_d73yj"] +[ext_resource type="Script" uid="uid://bj7rw2f6qu1lg" path="res://scripts/components/level/PlantField.cs" id="2_84bqh"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_0miwm"] shader = ExtResource("1_d73yj") diff --git a/scenes/level components/pools.tscn b/scenes/level components/pools.tscn index 81df8d9..eeb93d8 100644 --- a/scenes/level components/pools.tscn +++ b/scenes/level components/pools.tscn @@ -1,6 +1,6 @@ [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")] script = ExtResource("1_31ggc") diff --git a/scenes/prototype_survival.tscn b/scenes/prototype_survival.tscn new file mode 100644 index 0000000..f42552a --- /dev/null +++ b/scenes/prototype_survival.tscn @@ -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"] diff --git a/scenes/sun.tscn b/scenes/sun.tscn index 4d40d07..f39a8ac 100644 --- a/scenes/sun.tscn +++ b/scenes/sun.tscn @@ -1,7 +1,7 @@ [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="Script" path="res://scripts/Sun.cs" id="2_m8xcj"] +[ext_resource type="Shader" uid="uid://bk8uy5se3fo0" path="res://assets/shaders/shared_outline.gdshader" id="1_jcu1f"] +[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"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_u0o5k"] @@ -73,8 +73,8 @@ tracks/1/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_juv2v"] _data = { -"RESET": SubResource("Animation_jfrge"), -"main": SubResource("Animation_rvj0j") +&"RESET": SubResource("Animation_jfrge"), +&"main": SubResource("Animation_rvj0j") } [sub_resource type="Animation" id="Animation_t53pt"] @@ -108,8 +108,8 @@ tracks/0/keys = { [sub_resource type="AnimationLibrary" id="AnimationLibrary_p7c0n"] _data = { -"RESET": SubResource("Animation_t53pt"), -"main": SubResource("Animation_xyill") +&"RESET": SubResource("Animation_t53pt"), +&"main": SubResource("Animation_xyill") } [sub_resource type="CircleShape2D" id="CircleShape2D_7hl7x"] @@ -144,13 +144,13 @@ frame = 2 [node name="RotationAnimation" type="AnimationPlayer" parent="."] libraries = { -"": SubResource("AnimationLibrary_juv2v") +&"": SubResource("AnimationLibrary_juv2v") } autoplay = "main" [node name="FadeAnimation" type="AnimationPlayer" parent="."] libraries = { -"": SubResource("AnimationLibrary_p7c0n") +&"": SubResource("AnimationLibrary_p7c0n") } [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/scripts/DebugZombieSpawner.cs b/scripts/DebugZombieSpawner.cs new file mode 100644 index 0000000..cbab253 --- /dev/null +++ b/scripts/DebugZombieSpawner.cs @@ -0,0 +1,69 @@ +using Godot; +using System.Linq; +using System.Collections.Generic; + +public partial class DebugZombieSpawner : PopupPanel +{ + private List 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 x = [LevensteinDistance(a[1..], b[1..]), LevensteinDistance(a[1..], b), LevensteinDistance(a, b[1..])]; + return 1 + x.Min(); + } +} diff --git a/scripts/DebugZombieSpawner.cs.uid b/scripts/DebugZombieSpawner.cs.uid new file mode 100644 index 0000000..3f2c794 --- /dev/null +++ b/scripts/DebugZombieSpawner.cs.uid @@ -0,0 +1 @@ +uid://dac0bvlhho7u4 diff --git a/scripts/components/gui/choose_your_seeds/GridLoader.cs b/scripts/components/gui/choose_your_seeds/GridLoader.cs index fe9e145..81b04e6 100644 --- a/scripts/components/gui/choose_your_seeds/GridLoader.cs +++ b/scripts/components/gui/choose_your_seeds/GridLoader.cs @@ -12,19 +12,13 @@ public partial class GridLoader : GridContainer { _plantCard = ResourceLoader.Load("res://scenes/gui/seedpacket.tscn"); - string[] files = DirAccess.GetFilesAt(PLANT_RESOURCE_PATH); - - foreach(var file in files) + foreach(var resource in GameRegistry.GetPlants()) { - if(ResourceLoader.Exists(PLANT_RESOURCE_PATH+file)) - { - Seedpacket slot = _plantCard.Instantiate(); - AddChild(slot); - - slot.SetPlantResource(ResourceLoader.Load(PLANT_RESOURCE_PATH+file)); - slot.SetHandler(new ChoosableHandler(slot)); - } - + Seedpacket slot = _plantCard.Instantiate(); + AddChild(slot); + + slot.SetPlantResource(resource); + slot.SetHandler(new ChoosableHandler(slot)); } } } diff --git a/scripts/components/level/PoolContainer.cs b/scripts/components/level/PoolContainer.cs index cf490c6..1f22d52 100644 --- a/scripts/components/level/PoolContainer.cs +++ b/scripts/components/level/PoolContainer.cs @@ -8,7 +8,7 @@ namespace Newlon.Components.Level; // Is not pool in traditional sense, but named like that to prevent repetition // -public partial class PoolContainer : Node +public partial class PoolContainer : Node2D { [Export] public Node2D Zombies { get; private set; } diff --git a/scripts/components/level/zombe_spawners/ZombieSequencer.cs b/scripts/components/level/zombe_spawners/ZombieSequencer.cs new file mode 100644 index 0000000..66ada13 --- /dev/null +++ b/scripts/components/level/zombe_spawners/ZombieSequencer.cs @@ -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 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 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(); + 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); + } +} diff --git a/scripts/components/level/zombe_spawners/ZombieSequencer.cs.uid b/scripts/components/level/zombe_spawners/ZombieSequencer.cs.uid new file mode 100644 index 0000000..7f38459 --- /dev/null +++ b/scripts/components/level/zombe_spawners/ZombieSequencer.cs.uid @@ -0,0 +1 @@ +uid://bsuw5lvnr3kol diff --git a/scripts/components/plants/PlantEyesightLimiter.cs b/scripts/components/plants/PlantEyesightLimiter.cs index 1b1f628..60248d6 100644 --- a/scripts/components/plants/PlantEyesightLimiter.cs +++ b/scripts/components/plants/PlantEyesightLimiter.cs @@ -4,7 +4,7 @@ namespace Newlon.Components.Plants; public partial class PlantEyesightLimiter : CollisionShape2D { - public override void _Ready() + public override void _Process(double delta) { if (Shape is SegmentShape2D segment) { diff --git a/scripts/components/plants/behaviours/AloeBehaviour.cs b/scripts/components/plants/behaviours/AloeBehaviour.cs index 6233e8d..323f8ab 100644 --- a/scripts/components/plants/behaviours/AloeBehaviour.cs +++ b/scripts/components/plants/behaviours/AloeBehaviour.cs @@ -37,7 +37,6 @@ public partial class AloeBehaviour : BaseBehaviour if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData)) { plantData.Heal(3000 + 25 * plantData.MaxHp, GetParent()); - GD.Print("IM TRYING"); } } diff --git a/scripts/components/zombies/EatBox.cs b/scripts/components/zombies/EatBox.cs index dd05bb7..474371f 100644 --- a/scripts/components/zombies/EatBox.cs +++ b/scripts/components/zombies/EatBox.cs @@ -25,7 +25,6 @@ public partial class EatBox : Area2D public void OnAreaEntered(Area2D area) { var parent = area.GetParent(); - GD.Print(parent.Name); if (parent != null && parent is RuntimePlantData plantData) { diff --git a/scripts/components/zombies/ZombieMover.cs b/scripts/components/zombies/ZombieMover.cs index 891e193..f2cc17f 100644 --- a/scripts/components/zombies/ZombieMover.cs +++ b/scripts/components/zombies/ZombieMover.cs @@ -21,7 +21,6 @@ public partial class ZombieMover : Node * Utility.TileWidth * GetParent().LocalTimescale * _speed.GetValue(); - GD.Print(_speed.GetMult()); } public void SetSpeedFlat(float speed) diff --git a/scripts/debug/Cheats.cs b/scripts/debug/Cheats.cs index 701fb4f..6aef97a 100644 --- a/scripts/debug/Cheats.cs +++ b/scripts/debug/Cheats.cs @@ -12,5 +12,11 @@ public partial class Cheats : Node { RuntimeLevelData.Instance.AddSun(50); } + if (@event.IsActionPressed("cheat_zombie_spawn")) + { + var spawner = GD.Load("res://scenes/debug_zombie_spawner.tscn").Instantiate(); + + GetTree().CurrentScene.AddChild(spawner); + } } } diff --git a/scripts/resources/ZombieResource.cs b/scripts/resources/ZombieResource.cs new file mode 100644 index 0000000..6c6e217 --- /dev/null +++ b/scripts/resources/ZombieResource.cs @@ -0,0 +1,8 @@ +using Godot; + +[GlobalClass] +public partial class ZombieResource : Resource +{ + [Export] public int cost; + [Export] public PackedScene scene; +} diff --git a/scripts/resources/ZombieResource.cs.uid b/scripts/resources/ZombieResource.cs.uid new file mode 100644 index 0000000..55244c2 --- /dev/null +++ b/scripts/resources/ZombieResource.cs.uid @@ -0,0 +1 @@ +uid://cqxj7o8hdm82n diff --git a/scripts/systems/GameRegistry.cs b/scripts/systems/GameRegistry.cs new file mode 100644 index 0000000..b677a9d --- /dev/null +++ b/scripts/systems/GameRegistry.cs @@ -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 PlantDictionary = []; + private Dictionary 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(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(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 GetPlantNames() + { + List result = []; + foreach (var key in Instance.PlantDictionary.Keys) + { + result.Add(key); + } + return result; + } + public static List GetPlants() + { + List 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 GetZombieNames() + { + List result = []; + foreach (var key in Instance.ZombieDictionary.Keys) + { + result.Add(key); + } + return result; + } + public static List GetZombies() + { + List result = []; + foreach (var value in Instance.ZombieDictionary.Values) + { + result.Add(value); + } + return result; + } + +} diff --git a/scripts/systems/GameRegistry.cs.uid b/scripts/systems/GameRegistry.cs.uid new file mode 100644 index 0000000..3ee6738 --- /dev/null +++ b/scripts/systems/GameRegistry.cs.uid @@ -0,0 +1 @@ +uid://b66j681wn5tjn