Add Stage 3
This commit is contained in:
parent
dad5accaf0
commit
5db895de1e
7 changed files with 607 additions and 3 deletions
|
@ -11,7 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Frontier of Hell"
|
||||
run/main_scene="res://scenes/stages/stage_2.tscn"
|
||||
run/main_scene="res://scenes/stages/stage_3.tscn"
|
||||
config/features=PackedStringArray("4.1", "Mobile")
|
||||
boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 1)
|
||||
boot_splash/image="res://assets/icons/logo.png"
|
||||
|
|
299
scenes/stages/stage_3.tscn
Normal file
299
scenes/stages/stage_3.tscn
Normal file
|
@ -0,0 +1,299 @@
|
|||
[gd_scene load_steps=12 format=3 uid="uid://bxk5llqn5csgu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bq6hnxbt4w37u" path="res://assets/tileset/snowland/Snowland@64x64.png" id="1_l1d1t"]
|
||||
[ext_resource type="Script" path="res://scripts/stages/3/game_manager.gd" id="1_u4jwa"]
|
||||
[ext_resource type="PackedScene" uid="uid://bhnv1dsggssil" path="res://scenes/ui/pause_menu.tscn" id="2_ndso4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd5r1v6f8hahx" path="res://scenes/ui/tower_menu.tscn" id="3_eupq3"]
|
||||
[ext_resource type="Script" path="res://scripts/stages/3/summon.gd" id="3_wyim2"]
|
||||
[ext_resource type="PackedScene" uid="uid://cy88k4uxt1v37" path="res://scenes/ui/game_stats.tscn" id="4_2c35u"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvoenhbaqiqj2" path="res://scenes/towers/placement/placement.tscn" id="8_mm6r8"]
|
||||
[ext_resource type="PackedScene" uid="uid://cikgeqqhctm7k" path="res://scenes/base/base.tscn" id="9_057um"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_xqebe"]
|
||||
texture = ExtResource("1_l1d1t")
|
||||
texture_region_size = Vector2i(64, 64)
|
||||
0:0/0 = 0
|
||||
1:0/0 = 0
|
||||
2:0/0 = 0
|
||||
3:0/0 = 0
|
||||
4:0/0 = 0
|
||||
5:0/0 = 0
|
||||
6:0/0 = 0
|
||||
7:0/0 = 0
|
||||
8:0/0 = 0
|
||||
9:0/0 = 0
|
||||
10:0/0 = 0
|
||||
11:0/0 = 0
|
||||
12:0/0 = 0
|
||||
13:0/0 = 0
|
||||
14:0/0 = 0
|
||||
15:0/0 = 0
|
||||
0:1/0 = 0
|
||||
1:1/0 = 0
|
||||
2:1/0 = 0
|
||||
3:1/0 = 0
|
||||
4:1/0 = 0
|
||||
5:1/0 = 0
|
||||
6:1/0 = 0
|
||||
7:1/0 = 0
|
||||
8:1/0 = 0
|
||||
9:1/0 = 0
|
||||
10:1/0 = 0
|
||||
11:1/0 = 0
|
||||
12:1/0 = 0
|
||||
13:1/0 = 0
|
||||
14:1/0 = 0
|
||||
15:1/0 = 0
|
||||
0:2/0 = 0
|
||||
1:2/0 = 0
|
||||
2:2/0 = 0
|
||||
3:2/0 = 0
|
||||
4:2/0 = 0
|
||||
5:2/0 = 0
|
||||
6:2/0 = 0
|
||||
7:2/0 = 0
|
||||
8:2/0 = 0
|
||||
9:2/0 = 0
|
||||
10:2/0 = 0
|
||||
11:2/0 = 0
|
||||
12:2/0 = 0
|
||||
13:2/0 = 0
|
||||
14:2/0 = 0
|
||||
15:2/0 = 0
|
||||
0:3/0 = 0
|
||||
1:3/0 = 0
|
||||
2:3/0 = 0
|
||||
3:3/0 = 0
|
||||
4:3/0 = 0
|
||||
5:3/0 = 0
|
||||
6:3/0 = 0
|
||||
7:3/0 = 0
|
||||
8:3/0 = 0
|
||||
10:3/0 = 0
|
||||
11:3/0 = 0
|
||||
12:3/0 = 0
|
||||
13:3/0 = 0
|
||||
14:3/0 = 0
|
||||
15:3/0 = 0
|
||||
0:4/0 = 0
|
||||
1:4/0 = 0
|
||||
2:4/0 = 0
|
||||
3:4/0 = 0
|
||||
4:4/0 = 0
|
||||
5:4/0 = 0
|
||||
6:4/0 = 0
|
||||
7:4/0 = 0
|
||||
8:4/0 = 0
|
||||
10:4/0 = 0
|
||||
11:4/0 = 0
|
||||
12:4/0 = 0
|
||||
13:4/0 = 0
|
||||
14:4/0 = 0
|
||||
15:4/0 = 0
|
||||
0:5/0 = 0
|
||||
1:5/0 = 0
|
||||
2:5/0 = 0
|
||||
3:5/0 = 0
|
||||
4:5/0 = 0
|
||||
5:5/0 = 0
|
||||
6:5/0 = 0
|
||||
7:5/0 = 0
|
||||
8:5/0 = 0
|
||||
9:5/0 = 0
|
||||
10:5/0 = 0
|
||||
11:5/0 = 0
|
||||
13:5/0 = 0
|
||||
14:5/0 = 0
|
||||
15:5/0 = 0
|
||||
0:6/0 = 0
|
||||
1:6/0 = 0
|
||||
2:6/0 = 0
|
||||
3:6/0 = 0
|
||||
4:6/0 = 0
|
||||
5:6/0 = 0
|
||||
6:6/0 = 0
|
||||
7:6/0 = 0
|
||||
8:6/0 = 0
|
||||
9:6/0 = 0
|
||||
10:6/0 = 0
|
||||
11:6/0 = 0
|
||||
13:6/0 = 0
|
||||
14:6/0 = 0
|
||||
15:6/0 = 0
|
||||
0:7/0 = 0
|
||||
1:7/0 = 0
|
||||
2:7/0 = 0
|
||||
3:7/0 = 0
|
||||
4:7/0 = 0
|
||||
5:7/0 = 0
|
||||
6:7/0 = 0
|
||||
7:7/0 = 0
|
||||
8:7/0 = 0
|
||||
9:7/0 = 0
|
||||
10:7/0 = 0
|
||||
11:7/0 = 0
|
||||
12:7/0 = 0
|
||||
13:7/0 = 0
|
||||
14:7/0 = 0
|
||||
15:7/0 = 0
|
||||
0:8/0 = 0
|
||||
1:8/0 = 0
|
||||
2:8/0 = 0
|
||||
3:8/0 = 0
|
||||
4:8/0 = 0
|
||||
5:8/0 = 0
|
||||
6:8/0 = 0
|
||||
7:8/0 = 0
|
||||
8:8/0 = 0
|
||||
9:8/0 = 0
|
||||
10:8/0 = 0
|
||||
11:8/0 = 0
|
||||
12:8/0 = 0
|
||||
13:8/0 = 0
|
||||
14:8/0 = 0
|
||||
15:8/0 = 0
|
||||
0:9/0 = 0
|
||||
1:9/0 = 0
|
||||
2:9/0 = 0
|
||||
3:9/0 = 0
|
||||
4:9/0 = 0
|
||||
5:9/0 = 0
|
||||
6:9/0 = 0
|
||||
7:9/0 = 0
|
||||
8:9/0 = 0
|
||||
9:9/0 = 0
|
||||
10:9/0 = 0
|
||||
11:9/0 = 0
|
||||
12:9/0 = 0
|
||||
13:9/0 = 0
|
||||
14:9/0 = 0
|
||||
15:9/0 = 0
|
||||
0:10/0 = 0
|
||||
1:10/0 = 0
|
||||
2:10/0 = 0
|
||||
3:10/0 = 0
|
||||
4:10/0 = 0
|
||||
5:10/0 = 0
|
||||
6:10/0 = 0
|
||||
7:10/0 = 0
|
||||
8:10/0 = 0
|
||||
9:10/0 = 0
|
||||
10:10/0 = 0
|
||||
11:10/0 = 0
|
||||
12:10/0 = 0
|
||||
13:10/0 = 0
|
||||
14:10/0 = 0
|
||||
15:10/0 = 0
|
||||
9:11/0 = 0
|
||||
10:11/0 = 0
|
||||
11:11/0 = 0
|
||||
12:11/0 = 0
|
||||
13:11/0 = 0
|
||||
14:11/0 = 0
|
||||
15:11/0 = 0
|
||||
9:12/0 = 0
|
||||
10:12/0 = 0
|
||||
11:12/0 = 0
|
||||
12:12/0 = 0
|
||||
13:12/0 = 0
|
||||
14:12/0 = 0
|
||||
15:12/0 = 0
|
||||
12:13/0 = 0
|
||||
13:13/0 = 0
|
||||
14:13/0 = 0
|
||||
15:13/0 = 0
|
||||
8:14/0 = 0
|
||||
9:14/0 = 0
|
||||
10:14/0 = 0
|
||||
11:14/0 = 0
|
||||
12:14/0 = 0
|
||||
13:14/0 = 0
|
||||
14:14/0 = 0
|
||||
15:14/0 = 0
|
||||
8:15/0 = 0
|
||||
9:15/0 = 0
|
||||
10:15/0 = 0
|
||||
11:15/0 = 0
|
||||
12:15/0 = 0
|
||||
13:15/0 = 0
|
||||
0:11/size_in_atlas = Vector2i(5, 5)
|
||||
0:11/0 = 0
|
||||
5:11/size_in_atlas = Vector2i(3, 5)
|
||||
5:11/0 = 0
|
||||
8:11/size_in_atlas = Vector2i(1, 3)
|
||||
8:11/0 = 0
|
||||
9:13/size_in_atlas = Vector2i(3, 1)
|
||||
9:13/0 = 0
|
||||
12:5/size_in_atlas = Vector2i(1, 2)
|
||||
12:5/0 = 0
|
||||
9:3/size_in_atlas = Vector2i(1, 2)
|
||||
9:3/0 = 0
|
||||
14:15/size_in_atlas = Vector2i(2, 1)
|
||||
14:15/0 = 0
|
||||
|
||||
[sub_resource type="TileSet" id="TileSet_31fyl"]
|
||||
tile_size = Vector2i(64, 64)
|
||||
sources/0 = SubResource("TileSetAtlasSource_xqebe")
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_cwxcl"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, 729, -47, 0, 0, 0, 0, 723, 166, 0, 0, 0, 0, 224, 161, 0, 0, 0, 0, 218, 344, 0, 0, 0, 0, 917, 358, 0, 0, 0, 0, 921, 550, 0, 0, 0, 0, -62, 545)
|
||||
}
|
||||
point_count = 7
|
||||
|
||||
[node name="GameManager" type="Node2D"]
|
||||
script = ExtResource("1_u4jwa")
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
tile_set = SubResource("TileSet_31fyl")
|
||||
format = 2
|
||||
layer_0/tile_data = PackedInt32Array(11, 131072, 3, 65547, 131072, 3, 131083, 131072, 3, 131082, 131072, 3, 131081, 131072, 3, 131080, 131072, 3, 131079, 131072, 3, 131078, 131072, 3, 131077, 131072, 3, 131076, 131072, 3, 131075, 131072, 3, 196611, 131072, 3, 262147, 131072, 3, 327691, 131072, 3, 589823, 131072, 3, 524288, 131072, 3, 524289, 131072, 3, 524290, 131072, 3, 524291, 131072, 3, 524292, 131072, 3, 524293, 131072, 3, 524294, 131072, 3, 524295, 131072, 3, 524296, 131072, 3, 524297, 131072, 3, 524298, 131072, 3, 524299, 131072, 3, 524300, 131072, 3, 524301, 131072, 3, 458767, 262144, 1, 524303, 262144, 2, 524302, 131072, 3, 393231, 262144, 1, 327683, 131072, 3, 327684, 131072, 3, 327685, 131072, 3, 327686, 131072, 3, 327687, 131072, 3, 327688, 131072, 3, 327689, 131072, 3, 327690, 131072, 3, 327692, 131072, 3, 327693, 131072, 3, 327694, 131072, 3, 327695, 262144, 1, -65525, 131072, 3, 10, 0, 3, 65546, 393216, 1, 65545, 65536, 0, 65544, 65536, 0, 65543, 65536, 0, 65542, 65536, 0, 65541, 65536, 0, 65540, 65536, 0, 65538, 0, 0, 65539, 65536, 0, 131074, 0, 3, 196610, 0, 3, 262146, 0, 3, 327682, 0, 3, 393218, 0, 4, 393219, 131072, 4, 393220, 196608, 4, 393221, 196608, 4, 393222, 196608, 4, 393223, 196608, 4, 393224, 196608, 4, 393225, 196608, 4, 393226, 196608, 4, 393227, 196608, 4, 393228, 196608, 4, 393229, 393216, 0, 393230, 131072, 3, 458766, 131072, 3, 458764, 131072, 0, 458765, 393216, 1, 458763, 65536, 0, 458762, 65536, 0, 458761, 65536, 0, 458760, 65536, 0, 458759, 65536, 0, 458758, 65536, 0, 458757, 65536, 0, 458756, 65536, 0, 458755, 65536, 0, 458754, 65536, 0, 262149, 65536, 0, 262150, 65536, 0, 262151, 65536, 0, 262152, 65536, 0, 262153, 65536, 0, 262154, 65536, 0, 262155, 65536, 0, 262156, 65536, 0, 262157, 65536, 0, 262158, 65536, 0, 262159, 262144, 0, 262148, 327680, 1, 196612, 327680, 0, 196613, 131072, 4, 196614, 196608, 4, 196615, 196608, 4, 196616, 196608, 4, 196617, 196608, 4, 196618, 196608, 4, 196619, 196608, 4, 458753, 65536, 0, 458752, 65536, 0, 524287, 65536, 0, 655359, 196608, 4, 589824, 196608, 4, 589825, 196608, 4, 589826, 196608, 4, 589827, 196608, 4, 589828, 196608, 4, 589829, 196608, 4, 589830, 196608, 4, 589831, 196608, 4, 589832, 196608, 4, 589833, 196608, 4, 589834, 196608, 4, 589835, 196608, 4, 589836, 196608, 4, 589837, 196608, 4, 589838, 196608, 4, 589839, 262144, 4, 589840, 65536, 1, 524304, 65536, 1, 458768, 65536, 1, 393232, 65536, 1, 327696, 65536, 1, 262160, 65536, 1, 12, 262144, 1, 65548, 262144, 1, 131084, 262144, 1, 196620, 262144, 4, -65524, 262144, 1, -65526, 0, 3, 720895, 65536, 1, 655360, 65536, 1, 655361, 65536, 1, 655362, 65536, 1, 655363, 65536, 1, 655364, 65536, 1, 655365, 65536, 1, 655366, 65536, 1, 655367, 65536, 1, 655368, 65536, 1, 655369, 65536, 1, 655370, 65536, 1, 655371, 65536, 1, 655372, 65536, 1, 655373, 65536, 1, 655374, 65536, 1, 655375, 65536, 1, 655377, 65536, 1, 589841, 65536, 1, 524305, 65536, 1, 458769, 65536, 1, 393233, 65536, 1, 327697, 65536, 1, 262161, 65536, 1, 655376, 65536, 1, 196625, 65536, 1, 131089, 65536, 1, 65553, 65536, 1, 17, 65536, 1, 13, 65536, 1, 14, 65536, 1, 15, 65536, 1, 16, 65536, 1, 65552, 65536, 1, 131088, 65536, 1, 196624, 65536, 1, 196623, 65536, 1, 196622, 65536, 1, 196621, 65536, 1, 131085, 65536, 1, 65549, 65536, 1, 65550, 65536, 1, 65551, 65536, 1, 131087, 65536, 1, 131086, 65536, 1, 9, 65536, 1, 8, 65536, 1, 7, 65536, 1, 6, 65536, 1, 5, 65536, 1, 4, 65536, 1, 3, 65536, 1, 2, 65536, 1, 1, 65536, 1, 0, 65536, 1, 65536, 65536, 1, 131072, 65536, 1, 196608, 65536, 1, 196609, 65536, 1, 131073, 65536, 1, 65537, 65536, 1, 262144, 65536, 1, 327680, 65536, 1, 393216, 65536, 1, 393217, 65536, 1, 327681, 65536, 1, 262145, 65536, 1)
|
||||
layer_1/name = ""
|
||||
layer_1/enabled = true
|
||||
layer_1/modulate = Color(1, 1, 1, 1)
|
||||
layer_1/y_sort_enabled = false
|
||||
layer_1/y_sort_origin = 0
|
||||
layer_1/z_index = 0
|
||||
layer_1/tile_data = PackedInt32Array(65551, 327680, 11, 196624, 196608, 7, 196622, 196608, 7, 65549, 524288, 11, 196621, 720896, 12, 65537, 917504, 15, 589840, 786432, 5)
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="."]
|
||||
curve = SubResource("Curve2D_cwxcl")
|
||||
script = ExtResource("3_wyim2")
|
||||
|
||||
[node name="Timer" type="Timer" parent="Path2D"]
|
||||
one_shot = true
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="PauseMenu" parent="CanvasLayer" instance=ExtResource("2_ndso4")]
|
||||
visible = false
|
||||
|
||||
[node name="TowerMenu" parent="CanvasLayer" instance=ExtResource("3_eupq3")]
|
||||
visible = false
|
||||
|
||||
[node name="GameStats" parent="CanvasLayer" instance=ExtResource("4_2c35u")]
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Placements" type="Node2D" parent="."]
|
||||
|
||||
[node name="placement" parent="Placements" instance=ExtResource("8_mm6r8")]
|
||||
position = Vector2(77, 189)
|
||||
|
||||
[node name="placement2" parent="Placements" instance=ExtResource("8_mm6r8")]
|
||||
position = Vector2(76, 323)
|
||||
|
||||
[node name="placement3" parent="Placements" instance=ExtResource("8_mm6r8")]
|
||||
position = Vector2(1060, 446)
|
||||
|
||||
[node name="Bases" type="Node2D" parent="."]
|
||||
|
||||
[node name="base" parent="Bases" instance=ExtResource("9_057um")]
|
||||
position = Vector2(-36, 497)
|
||||
|
||||
[node name="base2" parent="Bases" instance=ExtResource("9_057um")]
|
||||
position = Vector2(-37, 541)
|
||||
|
||||
[node name="base3" parent="Bases" instance=ExtResource("9_057um")]
|
||||
position = Vector2(-36, 587)
|
||||
|
||||
[connection signal="timeout" from="Path2D/Timer" to="Path2D" method="_on_timer_timeout"]
|
|
@ -1,6 +1,5 @@
|
|||
extends Node
|
||||
|
||||
class_name Config
|
||||
|
||||
var game = {
|
||||
"health": 6,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
extends Node2D
|
||||
|
||||
class_name GameManager
|
||||
|
||||
var config_path = "res://scripts/stages/1/config.gd"
|
||||
var config = load(config_path).new()
|
||||
|
|
184
scripts/stages/3/config.gd
Normal file
184
scripts/stages/3/config.gd
Normal file
|
@ -0,0 +1,184 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var game = {
|
||||
"health": 6,
|
||||
"resource": 100,
|
||||
"spawn_timer": 3.0,
|
||||
"offset": [-40.0, 50.0],
|
||||
"path_direction": [
|
||||
[
|
||||
{
|
||||
"progress": 0,
|
||||
"direction": "front",
|
||||
},
|
||||
{
|
||||
"progress": 213,
|
||||
"direction": "left"
|
||||
},
|
||||
{
|
||||
"progress": 712,
|
||||
"direction": "front"
|
||||
},
|
||||
{
|
||||
"progress": 896,
|
||||
"direction": "right"
|
||||
},
|
||||
{
|
||||
"progress": 1593,
|
||||
"direction": "front"
|
||||
},
|
||||
{
|
||||
"progress": 1787,
|
||||
"direction": "left"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
var menu = [
|
||||
{
|
||||
"name": "Cannon",
|
||||
"image": load("res://assets/icons/towers/cannon-1.png"),
|
||||
"image_disabled": load("res://assets/icons/towers/cannon-1-disabled.png"),
|
||||
"price": 10
|
||||
},
|
||||
{
|
||||
"name": "Railgun",
|
||||
"image": load("res://assets/icons/towers/railgun-1.png"),
|
||||
"image_disabled": load("res://assets/icons/towers/railgun-1-disabled.png"),
|
||||
"price": 20
|
||||
},
|
||||
{
|
||||
"name": "Cannon (V2)",
|
||||
"image": load("res://assets/icons/towers/cannon-2.png"),
|
||||
"image_disabled": load("res://assets/icons/towers/cannon-2-disabled.png"),
|
||||
"price": 50
|
||||
},
|
||||
{
|
||||
"name": "Railgun (V2)",
|
||||
"image": load("res://assets/icons/towers/railgun-2.png"),
|
||||
"image_disabled": load("res://assets/icons/towers/railgun-2-disabled.png"),
|
||||
"price": 60
|
||||
},
|
||||
{
|
||||
"name": "Cannon (V3)",
|
||||
"image": load("res://assets/icons/towers/cannon-3.png"),
|
||||
"image_disabled": load("res://assets/icons/towers/cannon-3-disabled.png"),
|
||||
"price": 90
|
||||
},
|
||||
{
|
||||
"name": "Railgun (V3)",
|
||||
"image": load("res://assets/icons/towers/railgun-3.png"),
|
||||
"image_disabled": load("res://assets/icons/towers/railgun-3-disabled.png"),
|
||||
"price": 100
|
||||
}
|
||||
]
|
||||
|
||||
var tower = [
|
||||
{
|
||||
"name": "Cannon",
|
||||
"asset": preload("res://scenes/towers/cannon_1.tscn"),
|
||||
"bullet": preload("res://scenes/bullets/bullet_1.tscn"),
|
||||
"timer": 1,
|
||||
"speed": 200,
|
||||
"damage": 30,
|
||||
"health": 100,
|
||||
"durability_reduction": 10
|
||||
},
|
||||
{
|
||||
"name": "Railgun",
|
||||
"asset": preload("res://scenes/towers/railgun_1.tscn"),
|
||||
"bullet": preload("res://scenes/bullets/bullet_1.tscn"),
|
||||
"timer": 1,
|
||||
"speed": 200,
|
||||
"damage": 40,
|
||||
"health": 100,
|
||||
"durability_reduction": 10
|
||||
},
|
||||
{
|
||||
"name": "Cannon (V2)",
|
||||
"asset": preload("res://scenes/towers/cannon_2.tscn"),
|
||||
"bullet": preload("res://scenes/bullets/bullet_1.tscn"),
|
||||
"timer": 1,
|
||||
"speed": 200,
|
||||
"damage": 40,
|
||||
"health": 100,
|
||||
"durability_reduction": 10
|
||||
},
|
||||
{
|
||||
"name": "Railgun (V2)",
|
||||
"asset": preload("res://scenes/towers/railgun_2.tscn"),
|
||||
"bullet": preload("res://scenes/bullets/bullet_1.tscn"),
|
||||
"timer": 1,
|
||||
"speed": 200,
|
||||
"damage": 40,
|
||||
"health": 100,
|
||||
"durability_reduction": 10
|
||||
},
|
||||
{
|
||||
"name": "Cannon (V3)",
|
||||
"asset": preload("res://scenes/towers/cannon_3.tscn"),
|
||||
"bullet": preload("res://scenes/bullets/bullet_1.tscn"),
|
||||
"timer": 1,
|
||||
"speed": 200,
|
||||
"damage": 40,
|
||||
"health": 100,
|
||||
"durability_reduction": 10
|
||||
},
|
||||
{
|
||||
"name": "Railgun (V3)",
|
||||
"asset": preload("res://scenes/towers/railgun_3.tscn"),
|
||||
"bullet": preload("res://scenes/bullets/bullet_1.tscn"),
|
||||
"timer": 1,
|
||||
"speed": 200,
|
||||
"damage": 40,
|
||||
"health": 100,
|
||||
"durability_reduction": 10
|
||||
}
|
||||
]
|
||||
|
||||
var enemy = [
|
||||
{
|
||||
"name": "Demon",
|
||||
"health": 100,
|
||||
"speed": 30,
|
||||
"damage": 1,
|
||||
"reward": 10
|
||||
},
|
||||
{
|
||||
"name": "Orc",
|
||||
"health": 100,
|
||||
"speed": 30,
|
||||
"damage": 1,
|
||||
"reward": 20
|
||||
},
|
||||
{
|
||||
"name": "Cyclops",
|
||||
"health": 100,
|
||||
"speed": 30,
|
||||
"damage": 1,
|
||||
"reward": 30
|
||||
},
|
||||
{
|
||||
"name": "Demon Boar",
|
||||
"health": 100,
|
||||
"speed": 30,
|
||||
"damage": 1,
|
||||
"reward": 40
|
||||
},
|
||||
{
|
||||
"name": "Demon Fungus",
|
||||
"health": 100,
|
||||
"speed": 30,
|
||||
"damage": 1,
|
||||
"reward": 50
|
||||
},
|
||||
{
|
||||
"name": "Demon Shark",
|
||||
"health": 100,
|
||||
"speed": 30,
|
||||
"damage": 1,
|
||||
"reward": 60
|
||||
}
|
||||
]
|
93
scripts/stages/3/game_manager.gd
Normal file
93
scripts/stages/3/game_manager.gd
Normal file
|
@ -0,0 +1,93 @@
|
|||
extends Node2D
|
||||
|
||||
var config_path = "res://scripts/stages/3/config.gd"
|
||||
var config = load(config_path).new()
|
||||
|
||||
var data = {
|
||||
"paused": false,
|
||||
"tower": {},
|
||||
"health": config.game['health'],
|
||||
"resource": config.game['resource']
|
||||
}
|
||||
|
||||
func _ready():
|
||||
$CanvasLayer/GameStats.connect("on_paused", on_game_paused)
|
||||
$CanvasLayer/PauseMenu.connect("on_resume", on_game_resume)
|
||||
$CanvasLayer/GameStats.set_resource(data['resource'])
|
||||
var bases = $Bases.get_children()
|
||||
for base in bases:
|
||||
base.connect("enemy_entered_base", on_enemy_entered_base)
|
||||
var placements = $Placements.get_children()
|
||||
for placement in placements:
|
||||
placement.connect("on_placement", on_tower_placement)
|
||||
$CanvasLayer/TowerMenu.connect("build_tower", on_build_tower)
|
||||
|
||||
func on_game_paused():
|
||||
data['paused'] = !data['paused']
|
||||
get_tree().paused = data['paused']
|
||||
$CanvasLayer/PauseMenu.show_menu()
|
||||
|
||||
func on_game_resume():
|
||||
data['paused'] = !data['paused']
|
||||
get_tree().paused = data['paused']
|
||||
$CanvasLayer/PauseMenu.hide_menu()
|
||||
|
||||
func on_tower_placement(pos, tower_placement_id):
|
||||
var tower_id = null
|
||||
var disabled = false
|
||||
var disabled_2 = false
|
||||
if data['tower'].has(str(tower_placement_id)):
|
||||
match data['tower'][str(tower_placement_id)]['id']:
|
||||
0:
|
||||
tower_id = 2
|
||||
1:
|
||||
tower_id = 3
|
||||
2:
|
||||
tower_id = 4
|
||||
3:
|
||||
tower_id = 5
|
||||
_:
|
||||
tower_id = null
|
||||
|
||||
if data['resource'] < config.menu[tower_id]['price']:
|
||||
disabled = true
|
||||
else:
|
||||
if data['resource'] < config.menu[0]['price']:
|
||||
disabled = true
|
||||
if data['resource'] < config.menu[1]['price']:
|
||||
disabled_2 = true
|
||||
$CanvasLayer/TowerMenu.show_menu(tower_id, pos, tower_placement_id, disabled, disabled_2)
|
||||
|
||||
func on_build_tower(pos, tower_id, tower_placement_id):
|
||||
if data['tower'].has(str(tower_placement_id)):
|
||||
var current_tower = get_tree().current_scene.get_node(str(data['tower'][str(tower_placement_id)]['name']))
|
||||
current_tower.queue_free()
|
||||
else:
|
||||
data['tower'][str(tower_placement_id)] = {}
|
||||
|
||||
var tower = config.tower[tower_id]['asset'].instantiate()
|
||||
get_tree().current_scene.add_child(tower)
|
||||
tower.set_config(config_path)
|
||||
tower.set_tower(tower_id, tower_placement_id)
|
||||
tower.set_timer()
|
||||
tower.global_position = pos
|
||||
tower.connect("on_destroy", on_tower_destroy)
|
||||
|
||||
data['tower'][str(tower_placement_id)]['id'] = tower_id
|
||||
data['tower'][str(tower_placement_id)]['name'] = tower.name
|
||||
data['resource'] -= config.menu[tower_id]['price']
|
||||
$CanvasLayer/GameStats.set_resource(data['resource'])
|
||||
|
||||
func on_tower_destroy(tower_placement_id):
|
||||
data['tower'].erase(str(tower_placement_id))
|
||||
|
||||
func on_enemy_entered_base(enemy):
|
||||
data['health'] -= enemy.damage
|
||||
$CanvasLayer/GameStats.set_damage(enemy.damage)
|
||||
|
||||
if data['health'] < 1:
|
||||
print("Game Over")
|
||||
|
||||
func on_enemy_reward(value: int):
|
||||
data['resource'] += value
|
||||
$CanvasLayer/GameStats.set_resource(data['resource'])
|
30
scripts/stages/3/summon.gd
Normal file
30
scripts/stages/3/summon.gd
Normal file
|
@ -0,0 +1,30 @@
|
|||
extends Path2D
|
||||
|
||||
@onready var timer = $Timer
|
||||
@export var type: int = 0
|
||||
|
||||
var config_path = "res://scripts/stages/3/config.gd"
|
||||
var config = load(config_path).new()
|
||||
|
||||
var spawn_first: bool = true
|
||||
|
||||
var enemy: PackedScene = preload("res://scenes/enemies/demon.tscn")
|
||||
|
||||
func _ready():
|
||||
summon()
|
||||
timer.wait_time = config.game['spawn_timer']
|
||||
timer.start()
|
||||
|
||||
func _on_timer_timeout():
|
||||
summon()
|
||||
timer.start()
|
||||
|
||||
func summon():
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
var enemy_instance = enemy.instantiate()
|
||||
add_child(enemy_instance)
|
||||
enemy_instance.set_config(config_path)
|
||||
enemy_instance.set_enemy(0)
|
||||
enemy_instance.set_direction(type)
|
||||
enemy_instance.set_v_offset(rng.randf_range(config.game['offset'][0], config.game['offset'][1]))
|
Loading…
Reference in a new issue