diff --git a/Assets/Maps/map1.png b/Assets/Maps/map1.png index 14dd30b..e18e038 100644 Binary files a/Assets/Maps/map1.png and b/Assets/Maps/map1.png differ diff --git a/Game/Maps/map_1.gd b/Game/Maps/map_1.gd index ab7c18b..8f82d82 100644 --- a/Game/Maps/map_1.gd +++ b/Game/Maps/map_1.gd @@ -23,10 +23,19 @@ var waves = [ [50, 0.9, 0.1, 0.2, 0.7], #wave 5 ] +var currentwave = 0 +var endwave = false + func _on_timer_timeout() -> void: - spawnMonster() - + if endwave: + if not get_node("Path2D").get_children(): + endwave = false + get_node("CanvasLayer/SidePanel").Update_waves(currentwave + 1) #updating waves + else: + spawnMonster() + func spawnMonster(): + currentwave = 0 for w in waves: if w[0] > 0: if randf() < w[1]: #chance of generating any kind of enemy @@ -42,6 +51,9 @@ func spawnMonster(): path_2d.add_child(path) break break + else: + currentwave += 1 + endwave = true func decrease_life(damage) -> void: get_node("CanvasLayer/SidePanel").Update_Lifes(-damage) diff --git a/Game/sidepanel.gd b/Game/sidepanel.gd index 2bd5f0e..e3c208f 100644 --- a/Game/sidepanel.gd +++ b/Game/sidepanel.gd @@ -67,6 +67,9 @@ func get_Lifes(): func Update_Lifes(amount) -> void: lives += amount +func Update_waves(wavecount) -> void: + get_node("WaveCounter/HBoxContainer/Label").text = "Current wave: "+ str(wavecount) + func Update_Coins(amount) -> void: coins += amount diff --git a/Game/sidepanel.tscn b/Game/sidepanel.tscn index 958a6f8..738350b 100644 --- a/Game/sidepanel.tscn +++ b/Game/sidepanel.tscn @@ -1,10 +1,8 @@ -[gd_scene load_steps=17 format=3 uid="uid://ddn64i6logtw0"] +[gd_scene load_steps=16 format=3 uid="uid://ddn64i6logtw0"] [ext_resource type="Script" uid="uid://c6sh5em844tx2" path="res://Game/sidepanel.gd" id="1_klyhg"] [ext_resource type="FontFile" uid="uid://bu44ne346ymoe" path="res://Assets/Others/Canterbury.ttf" id="2_4l4p2"] -[sub_resource type="Theme" id="Theme_4l4p2"] - [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_4l4p2"] bg_color = Color(1, 1, 1, 0.447059) corner_radius_top_left = 20 @@ -133,7 +131,6 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme = SubResource("Theme_4l4p2") theme_override_constants/separation = 60 alignment = 1 @@ -322,6 +319,37 @@ theme_override_styles/pressed = SubResource("StyleBoxFlat_dgw1d") theme_override_styles/normal = SubResource("StyleBoxFlat_nctfw") text = "Exit" +[node name="WaveCounter" type="Panel" parent="."] +custom_minimum_size = Vector2(160, 0) +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -20.0 +offset_right = 20.0 +offset_bottom = 40.0 +grow_horizontal = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="WaveCounter"] +custom_minimum_size = Vector2(150, 0) +layout_mode = 1 +anchors_preset = 8 +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +offset_left = -75.0 +offset_top = -20.0 +offset_right = 75.0 +offset_bottom = 20.0 +grow_horizontal = 2 +grow_vertical = 2 +alignment = 1 + +[node name="Label" type="Label" parent="WaveCounter/HBoxContainer"] +layout_mode = 2 +text = "Current wave: 1" + [connection signal="pressed" from="Panel/HBoxContainer4/HBoxContainer4/Button3" to="." method="_on_button_3_pressed"] [connection signal="pressed" from="pausemenu/VBoxContainer/Button3" to="." method="_on_button_3_pressed"] [connection signal="pressed" from="pausemenu/VBoxContainer/Button2" to="." method="_on_button_2_pressed"]