Add Stage 4
This commit is contained in:
parent
5db895de1e
commit
23e7560083
5 changed files with 627 additions and 1 deletions
|
@ -11,7 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="Frontier of Hell"
|
||||
run/main_scene="res://scenes/stages/stage_3.tscn"
|
||||
run/main_scene="res://scenes/stages/stage_4.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"
|
||||
|
|
313
scenes/stages/stage_4.tscn
Normal file
313
scenes/stages/stage_4.tscn
Normal file
|
@ -0,0 +1,313 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://cxo5fh50r6uxs"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bq6hnxbt4w37u" path="res://assets/tileset/snowland/Snowland@64x64.png" id="1_436vn"]
|
||||
[ext_resource type="Script" path="res://scripts/stages/4/game_manager.gd" id="1_lhtrq"]
|
||||
[ext_resource type="Script" path="res://scripts/stages/4/summon.gd" id="3_iv4av"]
|
||||
[ext_resource type="PackedScene" uid="uid://bhnv1dsggssil" path="res://scenes/ui/pause_menu.tscn" id="4_ahd74"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd5r1v6f8hahx" path="res://scenes/ui/tower_menu.tscn" id="5_31eq4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cy88k4uxt1v37" path="res://scenes/ui/game_stats.tscn" id="6_hgjt3"]
|
||||
[ext_resource type="PackedScene" uid="uid://bvoenhbaqiqj2" path="res://scenes/towers/placement/placement.tscn" id="7_v8e5o"]
|
||||
[ext_resource type="PackedScene" uid="uid://cikgeqqhctm7k" path="res://scenes/base/base.tscn" id="8_trc1r"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_8oq7c"]
|
||||
texture = ExtResource("1_436vn")
|
||||
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
|
||||
14:15/0 = 0
|
||||
15: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
|
||||
|
||||
[sub_resource type="TileSet" id="TileSet_pcst7"]
|
||||
tile_size = Vector2i(64, 64)
|
||||
sources/0 = SubResource("TileSetAtlasSource_8oq7c")
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_jkmm5"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, -35, 474, 0, 0, 0, 0, 544, 466, 0, 0, 0, 0, 545, 162, 0, 0, 0, 0, 920, 156, 0, 0, 0, 0, 921, -47)
|
||||
}
|
||||
point_count = 5
|
||||
|
||||
[sub_resource type="Curve2D" id="Curve2D_r12af"]
|
||||
_data = {
|
||||
"points": PackedVector2Array(0, 0, 0, 0, -41, 488, 0, 0, 0, 0, 725, 478, 0, 0, 0, 0, 728, 555, 0, 0, 0, 0, 1181, 549)
|
||||
}
|
||||
point_count = 4
|
||||
|
||||
[node name="GameManager" type="Node2D"]
|
||||
script = ExtResource("1_lhtrq")
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
tile_set = SubResource("TileSet_pcst7")
|
||||
format = 2
|
||||
layer_0/tile_data = PackedInt32Array(131084, 786432, 8, 131083, 786432, 8, 131082, 786432, 8, 131081, 786432, 8, 131080, 786432, 8, 196616, 786432, 8, 262152, 786432, 8, 327688, 786432, 8, 458752, 786432, 8, 458753, 786432, 8, 458754, 786432, 8, 458755, 786432, 8, 458756, 786432, 8, 458757, 786432, 8, 458758, 786432, 8, 458759, 786432, 8, 458760, 786432, 8, 458761, 786432, 8, 458763, 786432, 8, 524299, 786432, 8, 524300, 786432, 8, 524301, 786432, 8, 524302, 786432, 8, 524305, 786432, 8, 524304, 786432, 8, 524303, 786432, 8, 458762, 786432, 8, 393224, 786432, 8, 524306, 786432, 8, 524287, 786432, 8, -65522, 786432, 8, 14, 786432, 8, 65550, 786432, 8, 131086, 786432, 8, 131085, 786432, 8, 589842, 720896, 0, 589840, 720896, 0, 589841, 720896, 0, 589839, 720896, 0, 589838, 720896, 0, 589837, 720896, 0, 589836, 720896, 0, 589835, 720896, 0, 589834, 917504, 1, 524298, 851968, 0, 524297, 720896, 0, 524296, 720896, 0, 524295, 786432, 0, 524288, 786432, 0, 196620, 786432, 0, 524289, 720896, 0, 524290, 720896, 0, 524291, 720896, 0, 524292, 720896, 0, 524293, 720896, 0, 524294, 720896, 0, 589823, 720896, 0, 458766, 720896, 3, 458767, 786432, 3, 458768, 786432, 3, 458769, 786432, 3, 458770, 786432, 3, 458765, 786432, 3, 458764, 655360, 3, 393228, 983040, 0, 393226, 786432, 3, 393227, 786432, 3, 393225, 655360, 3, 262153, 655360, 2, 327689, 655360, 2, 196618, 720896, 0, 196619, 720896, 0, 196621, 720896, 0, 196622, 720896, 0, 196623, 983040, 1, -65521, 655360, 2, 15, 655360, 2, 65551, 655360, 2, 131087, 655360, 2, 196617, 655360, 0, 458751, 786432, 3, 393216, 786432, 3, 393217, 786432, 3, 393218, 786432, 3, 393219, 786432, 3, 393220, 786432, 3, 393221, 786432, 3, 393222, 786432, 3, 131079, 851968, 1, 196615, 851968, 1, 262151, 851968, 1, 327687, 851968, 1, 393223, 851968, 3, 65543, 917504, 0, 65544, 786432, 3, 65545, 786432, 3, 65546, 786432, 3, 65547, 786432, 3, 65548, 786432, 3, 65549, 851968, 3, -65523, 851968, 1, 13, 851968, 1, 589824, 720896, 2, 589825, 720896, 2, 589826, 720896, 2, 589827, 720896, 2, 589828, 720896, 2, 589829, 720896, 2, 589830, 720896, 2, 589831, 720896, 2, 589832, 720896, 2, 589833, 720896, 2, 393233, 720896, 2, 327697, 720896, 2, 262161, 720896, 2, 262160, 720896, 1, 196624, 720896, 2, 131088, 720896, 2, 65552, 720896, 2, 16, 720896, 2, 17, 720896, 2, 65553, 720896, 2, 131089, 720896, 2, 196625, 720896, 2, 327696, 720896, 2, 393232, 720896, 2, 393231, 720896, 2, 393230, 786432, 2, 393229, 720896, 2, 327693, 720896, 2, 327692, 720896, 2, 327691, 720896, 2, 327690, 786432, 2, 262154, 720896, 2, 262155, 720896, 2, 262156, 720896, 2, 262157, 720896, 2, 262158, 720896, 2, 262159, 720896, 2, 327680, 720896, 2, 262144, 720896, 2, 196608, 720896, 2, 131072, 720896, 2, 65536, 720896, 2, 0, 720896, 2, 1, 720896, 2, 2, 720896, 2, 3, 720896, 2, 4, 720896, 2, 5, 720896, 2, 6, 720896, 2, 7, 720896, 2, 8, 720896, 2, 9, 720896, 2, 10, 720896, 2, 11, 786432, 2, 12, 720896, 2, 65542, 720896, 2, 131078, 720896, 2, 196614, 786432, 2, 262150, 720896, 2, 327686, 720896, 2, 327685, 720896, 2, 327684, 720896, 2, 327683, 720896, 2, 327682, 720896, 2, 327681, 720896, 2, 262145, 720896, 2, 196609, 720896, 1, 131073, 720896, 2, 65537, 786432, 1, 65538, 720896, 2, 65539, 720896, 2, 65540, 720896, 2, 65541, 720896, 2, 131077, 720896, 2, 196613, 720896, 2, 262149, 720896, 2, 262148, 720896, 1, 262146, 720896, 1, 196610, 720896, 2, 131074, 720896, 2, 131075, 720896, 2, 131076, 786432, 1, 196612, 720896, 2, 196611, 720896, 2, 655378, 720896, 2, 655377, 720896, 2, 655376, 720896, 2, 655375, 720896, 2, 655374, 720896, 2, 655373, 720896, 2, 655372, 720896, 2, 655371, 720896, 2, 655370, 720896, 2, 655369, 720896, 2, 655368, 720896, 2, 655367, 720896, 2, 655366, 720896, 2, 655365, 720896, 2, 655364, 720896, 2, 655363, 720896, 2, 655362, 720896, 2, 655361, 720896, 2, 655360, 720896, 2, 327695, 720896, 2, 327694, 720896, 2, 262147, 720896, 2)
|
||||
|
||||
[node name="Path2D" type="Path2D" parent="."]
|
||||
curve = SubResource("Curve2D_jkmm5")
|
||||
script = ExtResource("3_iv4av")
|
||||
|
||||
[node name="Timer" type="Timer" parent="Path2D"]
|
||||
one_shot = true
|
||||
|
||||
[node name="Path2D2" type="Path2D" parent="."]
|
||||
curve = SubResource("Curve2D_r12af")
|
||||
script = ExtResource("3_iv4av")
|
||||
type = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="Path2D2"]
|
||||
one_shot = true
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="PauseMenu" parent="CanvasLayer" instance=ExtResource("4_ahd74")]
|
||||
visible = false
|
||||
|
||||
[node name="TowerMenu" parent="CanvasLayer" instance=ExtResource("5_31eq4")]
|
||||
visible = false
|
||||
|
||||
[node name="GameStats" parent="CanvasLayer" instance=ExtResource("6_hgjt3")]
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Placements" type="Node2D" parent="."]
|
||||
|
||||
[node name="placement" parent="Placements" instance=ExtResource("7_v8e5o")]
|
||||
position = Vector2(416, 222)
|
||||
|
||||
[node name="placement2" parent="Placements" instance=ExtResource("7_v8e5o")]
|
||||
position = Vector2(671, 348)
|
||||
|
||||
[node name="placement3" parent="Placements" instance=ExtResource("7_v8e5o")]
|
||||
position = Vector2(929, 414)
|
||||
|
||||
[node name="placement4" parent="Placements" instance=ExtResource("7_v8e5o")]
|
||||
position = Vector2(737, 30)
|
||||
|
||||
[node name="Bases" type="Node2D" parent="."]
|
||||
|
||||
[node name="base" parent="Bases" instance=ExtResource("8_trc1r")]
|
||||
position = Vector2(1193, 523)
|
||||
|
||||
[node name="base2" parent="Bases" instance=ExtResource("8_trc1r")]
|
||||
position = Vector2(1192, 566)
|
||||
|
||||
[node name="base3" parent="Bases" instance=ExtResource("8_trc1r")]
|
||||
position = Vector2(910, -44)
|
||||
|
||||
[node name="base4" parent="Bases" instance=ExtResource("8_trc1r")]
|
||||
position = Vector2(951, -44)
|
||||
|
||||
[connection signal="timeout" from="Path2D/Timer" to="Path2D" method="_on_timer_timeout"]
|
||||
[connection signal="timeout" from="Path2D2/Timer" to="Path2D2" method="_on_timer_timeout"]
|
190
scripts/stages/4/config.gd
Normal file
190
scripts/stages/4/config.gd
Normal file
|
@ -0,0 +1,190 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var game = {
|
||||
"health": 6,
|
||||
"resource": 100,
|
||||
"spawn_timer": 3.0,
|
||||
"offset": [-20.0, 13.0],
|
||||
"path_direction": [
|
||||
[
|
||||
{
|
||||
"progress": 0,
|
||||
"direction": "right",
|
||||
},
|
||||
{
|
||||
"progress": 578,
|
||||
"direction": "back"
|
||||
},
|
||||
{
|
||||
"progress": 882,
|
||||
"direction": "right"
|
||||
},
|
||||
{
|
||||
"progress": 1260,
|
||||
"direction": "back"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"progress": 0,
|
||||
"direction": "right",
|
||||
},
|
||||
{
|
||||
"progress": 766,
|
||||
"direction": "front"
|
||||
},
|
||||
{
|
||||
"progress": 843,
|
||||
"direction": "right"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
|
||||
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/4/game_manager.gd
Normal file
93
scripts/stages/4/game_manager.gd
Normal file
|
@ -0,0 +1,93 @@
|
|||
extends Node2D
|
||||
|
||||
var config_path = "res://scripts/stages/4/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/4/summon.gd
Normal file
30
scripts/stages/4/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/4/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