summaryrefslogtreecommitdiff
path: root/Stages/Wintermaul
diff options
context:
space:
mode:
Diffstat (limited to 'Stages/Wintermaul')
-rw-r--r--Stages/Wintermaul/HUD.gd46
-rw-r--r--Stages/Wintermaul/HUD.tscn151
-rw-r--r--Stages/Wintermaul/Wintermaul.tscn25
-rw-r--r--Stages/Wintermaul/hud_tower.gd225
-rw-r--r--Stages/Wintermaul/hud_tower.tscn90
-rw-r--r--Stages/Wintermaul/wintermaul.gd40
6 files changed, 485 insertions, 92 deletions
diff --git a/Stages/Wintermaul/HUD.gd b/Stages/Wintermaul/HUD.gd
index 6063b18..8457ab2 100644
--- a/Stages/Wintermaul/HUD.gd
+++ b/Stages/Wintermaul/HUD.gd
@@ -7,9 +7,7 @@ var selected_group := "":
set(value):
redraw_multiselect(selected_group, value)
selected_group = value
- redraw_select(selection_groups[selected_group][0].get_hud())
-
-signal attack_value_changed(value: int)
+ redraw_select(selection_groups[selected_group][0])
@onready var time: Label = %Time
@onready var money: Label = %Money
@@ -43,19 +41,19 @@ func _ready():
# multi select
%SelectionContainer.visible = false
- %SelectionData.get_child(0).queue_free()
%MultiSelectionContainer.visible = false
Client.placed_tower.connect(func(tower: Tower):
if tower.owner_id == multiplayer.get_unique_id():
tower.selected.connect(func():
- var hud_data = tower.get_hud()
-
var multi_select_hud_data = TextureRect.new()
multi_select_hud_data.name = tower.name
multi_select_hud_data.modulate = Color(0.5, 0.5, 0.5)
+ multi_select_hud_data.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
+ multi_select_hud_data.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
+ multi_select_hud_data.custom_minimum_size = Vector2(32, 64)
var texture = AtlasTexture.new()
- texture.atlas = preload("res://core_outdoor.png")
- texture.region = Rect2(400, 432, 32, 48)
+ texture.atlas = preload("res://Towers/Assets/spritesheet.png")
+ texture.region = Rect2(5, 1, 62, 95)
multi_select_hud_data.texture = texture
if not tower.selection_group_id in selection_groups:
@@ -67,14 +65,16 @@ func _ready():
%SelectionContainer.visible = true
%MultiSelectionContainer.visible = false
- redraw_select(hud_data)
%MultiSelectionList.add_child(multi_select_hud_data)
+ selected_group = tower.selection_group_id
elif Tower.selected_towers.size() > 1:
%MultiSelectionContainer.visible = true
%MultiSelectionList.add_child(multi_select_hud_data)
redraw_multiselect("", selected_group)
+
+ redraw_select(tower)
)
tower.deselected.connect(func():
@@ -82,14 +82,15 @@ func _ready():
%SelectionContainer.visible = false
%MultiSelectionContainer.visible = false
- for child in %SelectionData.get_children():
- child.queue_free()
for child in %MultiSelectionList.get_children():
child.queue_free()
elif Tower.selected_towers.size() == 1:
%MultiSelectionContainer.visible = false
%SelectionContainer.visible = true
- %MultiSelectionList.get_node(NodePath(tower.name)).queue_free()
+
+ var node = %MultiSelectionList.get_node_or_null(NodePath(tower.name))
+ if node:
+ node.queue_free()
elif Tower.selected_towers.size() > 1:
# only remove deselected tower from list
var node = %MultiSelectionList.get_node_or_null(NodePath(tower.name))
@@ -116,11 +117,7 @@ func _ready():
%MultiSelectionList.get_node(NodePath(tower.name)).remove_from_group(previous_id)
if tower.name == selection_groups[tower.selection_group_id][0].name:
- redraw_select(tower.get_hud())
- )
-
- tower.attack_value_changed.connect(func(value: int):
- attack_value_changed.emit(value)
+ redraw_select(tower)
)
)
@@ -144,11 +141,8 @@ func _input(event: InputEvent):
selected_group = keys[(current_idx + 1) % keys.size()]
-func redraw_select(hud_data: Control):
- for node in %SelectionData.get_children():
- node.queue_free()
-
- %SelectionData.add_child(hud_data)
+func redraw_select(tower: Tower):
+ %TowerData.current_tower = tower
func redraw_multiselect(previous_group: String, new_group: String):
@@ -163,10 +157,14 @@ func redraw_multiselect(previous_group: String, new_group: String):
for node in get_tree().get_nodes_in_group(previous_group):
node.modulate = Color(0.5, 0.5, 0.5)
- Client.current_stage.get_node("%Towers/" + node.name).is_highlighted = false
+ var tower = Client.current_stage.get_node_or_null("%Towers/" + node.name)
+ if tower:
+ tower.is_highlighted = false
for node in get_tree().get_nodes_in_group(new_group):
node.modulate = Color(1.0, 1.0, 1.0)
- Client.current_stage.get_node("%Towers/" + node.name).is_highlighted = true
+ var tower = Client.current_stage.get_node_or_null("%Towers/" + node.name)
+ if tower:
+ tower.is_highlighted = true
func get_ordered_group_keys() -> Array:
diff --git a/Stages/Wintermaul/HUD.tscn b/Stages/Wintermaul/HUD.tscn
index 279c967..7ec86b5 100644
--- a/Stages/Wintermaul/HUD.tscn
+++ b/Stages/Wintermaul/HUD.tscn
@@ -1,10 +1,12 @@
-[gd_scene load_steps=24 format=3 uid="uid://bylx30cweulmk"]
+[gd_scene load_steps=25 format=3 uid="uid://bylx30cweulmk"]
[ext_resource type="Script" path="res://Stages/Wintermaul/HUD.gd" id="1_2bu0v"]
[ext_resource type="Texture2D" uid="uid://dlg78heamuf5g" path="res://Assets/UI/tilemap_white.png" id="2_dyehp"]
[ext_resource type="PackedScene" uid="uid://x6kohecnw7f5" path="res://UI/SpawnButton.tscn" id="3_7eaea"]
[ext_resource type="Texture2D" uid="uid://up1rtweit3ut" path="res://Assets/Mobs/angesnow-menu01.png" id="4_w7sef"]
+[ext_resource type="PackedScene" uid="uid://dslebs7aarkoa" path="res://UI/panel_background_blue.tscn" id="4_x1gx8"]
[ext_resource type="Theme" uid="uid://c7f1ftrx53ag1" path="res://theme.tres" id="5_121ry"]
+[ext_resource type="PackedScene" uid="uid://ei0ai7om3mkw" path="res://Stages/Wintermaul/hud_tower.tscn" id="5_hbytm"]
[ext_resource type="Texture2D" uid="uid://dq2i36oe1wj0m" path="res://Assets/Mobs/mob-pressed.png" id="5_xcxr8"]
[ext_resource type="Texture2D" uid="uid://dnkr5y0cfxu68" path="res://Assets/Mobs/mob-hovered.png" id="6_4go2d"]
[ext_resource type="Texture2D" uid="uid://dsy7k2v5fhh6v" path="res://Assets/Mobs/angesnow-front.png" id="7_ba5tw"]
@@ -18,9 +20,6 @@
[ext_resource type="PackedScene" uid="uid://cxd6c4kbnk04c" path="res://UI/PlayersList.tscn" id="16_mq4um"]
[ext_resource type="PackedScene" uid="uid://c05aq7xd4kx1p" path="res://UI/TowerConfiguration.tscn" id="17_1c5dq"]
-[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3rjde"]
-bg_color = Color(0, 0, 0, 0.54902)
-
[sub_resource type="AtlasTexture" id="AtlasTexture_byi0r"]
atlas = ExtResource("2_dyehp")
region = Rect2(392, 69, 13, 13)
@@ -47,121 +46,128 @@ anchors_preset = 10
anchor_right = 1.0
offset_bottom = 29.0
grow_horizontal = 2
-theme_override_styles/panel = SubResource("StyleBoxFlat_3rjde")
+theme = ExtResource("5_121ry")
+
+[node name="PanelBackgroundBlue" parent="Panel" instance=ExtResource("4_x1gx8")]
+layout_mode = 2
-[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
+[node name="MarginContainer" type="MarginContainer" parent="Panel"]
+layout_mode = 2
+theme_override_constants/margin_left = 16
+theme_override_constants/margin_top = 12
+theme_override_constants/margin_right = 12
+theme_override_constants/margin_bottom = 8
+
+[node name="VBoxContainer" type="VBoxContainer" parent="Panel/MarginContainer"]
layout_mode = 2
-[node name="Container" type="HBoxContainer" parent="Panel/VBoxContainer"]
+[node name="Container" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer"]
layout_mode = 2
-[node name="GridContainer" type="GridContainer" parent="Panel/VBoxContainer/Container"]
+[node name="GridContainer" type="GridContainer" parent="Panel/MarginContainer/VBoxContainer/Container"]
layout_mode = 2
columns = 3
-[node name="MarginContainer" type="MarginContainer" parent="Panel/VBoxContainer/Container/GridContainer"]
+[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer"]
layout_mode = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
-[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer"]
+[node name="HBoxContainer" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer"]
layout_mode = 2
-[node name="BuildModeButton" type="TextureRect" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer"]
+[node name="BuildModeButton" type="TextureRect" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer"]
texture_filter = 1
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = SubResource("AtlasTexture_byi0r")
expand_mode = 1
-[node name="Label" type="Label" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer"]
+[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer"]
layout_mode = 2
text = "Build Mode"
-[node name="MarginContainer2" type="MarginContainer" parent="Panel/VBoxContainer/Container/GridContainer"]
+[node name="MarginContainer2" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer"]
layout_mode = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
-[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer2"]
+[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer2"]
layout_mode = 2
-[node name="SpawnerBoxButton" type="TextureRect" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2"]
+[node name="SpawnerBoxButton" type="TextureRect" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2"]
texture_filter = 1
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = SubResource("AtlasTexture_dixt2")
expand_mode = 1
-[node name="Label" type="Label" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2"]
+[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2"]
layout_mode = 2
text = "Spawn Box"
-[node name="MarginContainer3" type="MarginContainer" parent="Panel/VBoxContainer/Container/GridContainer"]
+[node name="MarginContainer3" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer"]
layout_mode = 2
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
theme_override_constants/margin_bottom = 4
-[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer3"]
+[node name="HBoxContainer2" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer3"]
layout_mode = 2
-[node name="PlayerListButton" type="TextureRect" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2"]
+[node name="PlayerListButton" type="TextureRect" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2"]
texture_filter = 1
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = SubResource("AtlasTexture_tuk1j")
expand_mode = 1
-[node name="Label" type="Label" parent="Panel/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2"]
+[node name="Label" type="Label" parent="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2"]
layout_mode = 2
text = "Players List"
-[node name="Control" type="Control" parent="Panel/VBoxContainer/Container"]
+[node name="Control" type="Control" parent="Panel/MarginContainer/VBoxContainer/Container"]
layout_mode = 2
size_flags_horizontal = 3
-[node name="MarginContainer" type="MarginContainer" parent="Panel/VBoxContainer/Container"]
+[node name="MarginContainer" type="MarginContainer" parent="Panel/MarginContainer/VBoxContainer/Container"]
layout_mode = 2
theme_override_constants/margin_right = 8
-[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer/Container/MarginContainer"]
+[node name="HBoxContainer" type="HBoxContainer" parent="Panel/MarginContainer/VBoxContainer/Container/MarginContainer"]
layout_mode = 2
-[node name="Time" type="Label" parent="Panel/VBoxContainer/Container/MarginContainer/HBoxContainer"]
+[node name="Time" type="Label" parent="Panel/MarginContainer/VBoxContainer/Container/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "0"
-[node name="Money" type="Label" parent="Panel/VBoxContainer/Container/MarginContainer/HBoxContainer"]
+[node name="Money" type="Label" parent="Panel/MarginContainer/VBoxContainer/Container/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "0"
-[node name="Income" type="Label" parent="Panel/VBoxContainer/Container/MarginContainer/HBoxContainer"]
+[node name="Income" type="Label" parent="Panel/MarginContainer/VBoxContainer/Container/MarginContainer/HBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "0"
-[node name="ColorRect" type="ColorRect" parent="Panel/VBoxContainer"]
-custom_minimum_size = Vector2(0, 1)
-layout_mode = 2
-
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -288.0
-offset_top = 41.0
+offset_top = 67.0
offset_right = -4.0
-offset_bottom = 131.0
+offset_bottom = 199.0
grow_horizontal = 0
mouse_filter = 0
+theme = ExtResource("5_121ry")
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
@@ -201,6 +207,7 @@ anchor_bottom = 1.0
offset_top = -120.0
grow_horizontal = 2
grow_vertical = 0
+theme = ExtResource("5_121ry")
theme_override_constants/margin_left = 4
theme_override_constants/margin_top = 4
theme_override_constants/margin_right = 4
@@ -216,12 +223,15 @@ size_flags_horizontal = 3
size_flags_stretch_ratio = 100.0
mouse_filter = 1
+[node name="PanelBackgroundBlue" parent="MarginContainer/HBoxContainer/TowerConfigurationsContainer" instance=ExtResource("4_x1gx8")]
+layout_mode = 2
+
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/TowerConfigurationsContainer"]
layout_mode = 2
-theme_override_constants/margin_left = 8
-theme_override_constants/margin_top = 8
-theme_override_constants/margin_right = 8
-theme_override_constants/margin_bottom = 8
+theme_override_constants/margin_left = 16
+theme_override_constants/margin_top = 16
+theme_override_constants/margin_right = 16
+theme_override_constants/margin_bottom = 24
[node name="ScrollContainer" type="ScrollContainer" parent="MarginContainer/HBoxContainer/TowerConfigurationsContainer/MarginContainer"]
layout_mode = 2
@@ -242,11 +252,14 @@ layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 100.0
+[node name="PanelBackgroundBlue" parent="MarginContainer/HBoxContainer/MultiSelectionContainer" instance=ExtResource("4_x1gx8")]
+layout_mode = 2
+
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/MultiSelectionContainer"]
layout_mode = 2
-theme_override_constants/margin_left = 4
-theme_override_constants/margin_top = 4
-theme_override_constants/margin_right = 4
+theme_override_constants/margin_left = 16
+theme_override_constants/margin_top = 8
+theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 4
[node name="MultiSelectionList" type="HFlowContainer" parent="MarginContainer/HBoxContainer/MultiSelectionContainer/MarginContainer"]
@@ -261,20 +274,20 @@ layout_mode = 2
size_flags_horizontal = 10
size_flags_stretch_ratio = 2.0
-[node name="SelectionData" type="MarginContainer" parent="MarginContainer/HBoxContainer/SelectionContainer"]
-unique_name_in_owner = true
+[node name="PanelBackgroundBlue" parent="MarginContainer/HBoxContainer/SelectionContainer" instance=ExtResource("4_x1gx8")]
layout_mode = 2
-theme_override_constants/margin_left = 4
-theme_override_constants/margin_top = 4
-theme_override_constants/margin_right = 4
-theme_override_constants/margin_bottom = 4
-[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HBoxContainer/SelectionContainer/SelectionData"]
+[node name="SelectionData" type="MarginContainer" parent="MarginContainer/HBoxContainer/SelectionContainer"]
+unique_name_in_owner = true
layout_mode = 2
+theme_override_constants/margin_left = 16
+theme_override_constants/margin_top = 16
+theme_override_constants/margin_right = 16
+theme_override_constants/margin_bottom = 24
-[node name="Label" type="Label" parent="MarginContainer/HBoxContainer/SelectionContainer/SelectionData/VBoxContainer"]
+[node name="TowerData" parent="MarginContainer/HBoxContainer/SelectionContainer/SelectionData" instance=ExtResource("5_hbytm")]
+unique_name_in_owner = true
layout_mode = 2
-text = "T"
[node name="SpawnBox" type="PanelContainer" parent="MarginContainer/HBoxContainer"]
unique_name_in_owner = true
@@ -282,13 +295,17 @@ layout_mode = 2
size_flags_horizontal = 10
size_flags_vertical = 8
size_flags_stretch_ratio = 0.0
+theme = ExtResource("5_121ry")
+
+[node name="PanelBackgroundBlue" parent="MarginContainer/HBoxContainer/SpawnBox" instance=ExtResource("4_x1gx8")]
+layout_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HBoxContainer/SpawnBox"]
layout_mode = 2
-theme_override_constants/margin_left = 8
-theme_override_constants/margin_top = 8
-theme_override_constants/margin_right = 8
-theme_override_constants/margin_bottom = 8
+theme_override_constants/margin_left = 16
+theme_override_constants/margin_top = 16
+theme_override_constants/margin_right = 16
+theme_override_constants/margin_bottom = 16
[node name="GridContainer" type="GridContainer" parent="MarginContainer/HBoxContainer/SpawnBox/MarginContainer"]
layout_mode = 2
@@ -373,6 +390,30 @@ texture_normal = ExtResource("14_t3qlu")
texture_pressed = ExtResource("5_xcxr8")
texture_hover = ExtResource("6_4go2d")
-[connection signal="gui_input" from="Panel/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer/BuildModeButton" to="." method="_on_build_mode_button_gui_input"]
-[connection signal="gui_input" from="Panel/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2/SpawnerBoxButton" to="." method="_on_spawner_box_button_gui_input"]
-[connection signal="gui_input" from="Panel/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2/PlayerListButton" to="." method="_on_player_list_button_gui_input"]
+[node name="SpawnButton13" parent="MarginContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+layout_mode = 2
+texture_normal = ExtResource("14_t3qlu")
+texture_pressed = ExtResource("5_xcxr8")
+texture_hover = ExtResource("6_4go2d")
+
+[node name="SpawnButton14" parent="MarginContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+layout_mode = 2
+texture_normal = ExtResource("14_t3qlu")
+texture_pressed = ExtResource("5_xcxr8")
+texture_hover = ExtResource("6_4go2d")
+
+[node name="SpawnButton15" parent="MarginContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+layout_mode = 2
+texture_normal = ExtResource("14_t3qlu")
+texture_pressed = ExtResource("5_xcxr8")
+texture_hover = ExtResource("6_4go2d")
+
+[node name="SpawnButton16" parent="MarginContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
+layout_mode = 2
+texture_normal = ExtResource("14_t3qlu")
+texture_pressed = ExtResource("5_xcxr8")
+texture_hover = ExtResource("6_4go2d")
+
+[connection signal="gui_input" from="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer/HBoxContainer/BuildModeButton" to="." method="_on_build_mode_button_gui_input"]
+[connection signal="gui_input" from="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer2/HBoxContainer2/SpawnerBoxButton" to="." method="_on_spawner_box_button_gui_input"]
+[connection signal="gui_input" from="Panel/MarginContainer/VBoxContainer/Container/GridContainer/MarginContainer3/HBoxContainer2/PlayerListButton" to="." method="_on_player_list_button_gui_input"]
diff --git a/Stages/Wintermaul/Wintermaul.tscn b/Stages/Wintermaul/Wintermaul.tscn
index bebc79c..c19a766 100644
--- a/Stages/Wintermaul/Wintermaul.tscn
+++ b/Stages/Wintermaul/Wintermaul.tscn
@@ -1,7 +1,9 @@
-[gd_scene load_steps=14 format=4 uid="uid://bl65jllb3e2py"]
+[gd_scene load_steps=17 format=4 uid="uid://bl65jllb3e2py"]
[ext_resource type="Script" path="res://Stages/Wintermaul/wintermaul.gd" id="1_o88ua"]
+[ext_resource type="Shader" path="res://UI/sliding_background.gdshader" id="2_tom3b"]
[ext_resource type="PackedScene" uid="uid://bylx30cweulmk" path="res://Stages/Wintermaul/HUD.tscn" id="2_v3f6l"]
+[ext_resource type="Texture2D" uid="uid://drtbodnnqibxr" path="res://UI/Assets/background_pattern.png" id="3_6tlr4"]
[ext_resource type="PackedScene" uid="uid://of5ggu6lifwy" path="res://Stages/Paths/Spawn.tscn" id="3_f2sda"]
[ext_resource type="TileSet" uid="uid://0he3f625ne0k" path="res://Stages/Wintermaul/TileSet.tres" id="3_q7qd0"]
[ext_resource type="PackedScene" uid="uid://2lt8m7df0e2u" path="res://Stages/Paths/Goal.tscn" id="5_dp16q"]
@@ -12,6 +14,14 @@
[ext_resource type="PackedScene" uid="uid://cg16o7eqqha70" path="res://Game/States/Default/StateDefault.tscn" id="23_qknks"]
[ext_resource type="PackedScene" uid="uid://bo5dp02vlui3l" path="res://Game/States/Build/StateBuild.tscn" id="24_yl2il"]
+[sub_resource type="ShaderMaterial" id="ShaderMaterial_078bg"]
+shader = ExtResource("2_tom3b")
+shader_parameter/bg_color = Color(0, 0, 0, 1)
+shader_parameter/pattern_color = Color(0.113725, 0.176471, 0.113725, 1)
+shader_parameter/pattern_size = 256.0
+shader_parameter/speed = 0.05
+shader_parameter/pattern_sampler = ExtResource("3_6tlr4")
+
[sub_resource type="RectangleShape2D" id="RectangleShape2D_513n2"]
size = Vector2(1581, 650)
@@ -21,9 +31,20 @@ size = Vector2(1581, 648)
[node name="World" type="Node2D"]
script = ExtResource("1_o88ua")
+[node name="Background" type="CanvasLayer" parent="."]
+layer = -1
+
+[node name="ColorRect" type="ColorRect" parent="Background"]
+material = SubResource("ShaderMaterial_078bg")
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+color = Color(0, 0, 0, 1)
+
[node name="HUD" parent="." instance=ExtResource("2_v3f6l")]
unique_name_in_owner = true
-visible = true
[node name="Map" type="TileMapLayer" parent="."]
unique_name_in_owner = true
diff --git a/Stages/Wintermaul/hud_tower.gd b/Stages/Wintermaul/hud_tower.gd
new file mode 100644
index 0000000..9d2ca1b
--- /dev/null
+++ b/Stages/Wintermaul/hud_tower.gd
@@ -0,0 +1,225 @@
+extends Control
+
+
+#signal range_applied(previous_value: int, current_value: int, number_of_towers: int)
+#signal power_applied(previous_value: int, current_value: int, number_of_towers: int)
+#signal speed_applied(previous_value: int, current_value: int, number_of_towers: int)
+
+var current_tower: Tower:
+ set = set_current_tower
+
+
+func set_current_tower(tower: Tower):
+ if current_tower and is_instance_valid(current_tower):
+ current_tower.components_changed.disconnect(redraw_components)
+
+ current_tower = tower
+
+ redraw_components()
+ current_tower.components_changed.connect(redraw_components)
+ %Data.text = "Range: %s - Power: %s - Speed: %s" % [
+ current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed
+ ]
+
+
+func redraw_components():
+ for node in %Components.get_children():
+ node.modulate = Color(1.0, 1.0, 1.0, 0.5)
+ node.get_node("Level").text = str(0)
+
+ for idx in range(current_tower.components.size()):
+ var component = current_tower.components[idx]
+ %Components.get_node(component.name).modulate = Color(1.0, 1.0, 1.0, 1.0)
+ %Components.get_node(component.name).get_node("Level").text = ": %s" % [component.level]
+
+
+func get_selected_towers() -> Array:
+ var hud: HUD = Client.current_stage.get_node("%HUD")
+
+ # TODO: key not found error sometimes?
+ return hud.selection_groups[hud.selected_group].duplicate()
+
+
+func _on_range_plus_pressed() -> void:
+ var towers = get_selected_towers()
+
+ var cost = Client.current_stage.price_map.tower.attack_range.call(current_tower.attack_range, towers.size())
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ tower.attack_range += 8
+ tower.selection_group_id = tower.get_group_id()
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+ %Data.text = "Range: %s - Power: %s - Speed: %s" % [
+ current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed
+ ]
+
+
+func _on_power_plus_pressed() -> void:
+ var towers = get_selected_towers()
+
+ var cost = Client.current_stage.price_map.tower.attack_power.call(current_tower.attack_power, towers.size())
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ tower.attack_power += 1
+ tower.selection_group_id = tower.get_group_id()
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+ %Data.text = "Range: %s - Power: %s - Speed: %s" % [
+ current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed
+ ]
+
+
+func _on_speed_plus_pressed() -> void:
+ var towers = get_selected_towers()
+
+ var cost = Client.current_stage.price_map.tower.attack_speed.call(current_tower.attack_speed, towers.size())
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ tower.attack_speed += 1
+ tower.selection_group_id = tower.get_group_id()
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+ %Data.text = "Range: %s - Power: %s - Speed: %s" % [
+ current_tower.attack_range, current_tower.attack_power, current_tower.attack_speed
+ ]
+
+
+func _on_frost_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ get_viewport().set_input_as_handled()
+
+ var towers = get_selected_towers()
+
+ var cost = 100 * towers.size()
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ var found = false
+ for idx in range(tower.components.size()):
+ var component = tower.components[idx]
+ if component.name == "Frost":
+ found = true
+ tower.remove_component(component.name)
+ break
+
+ if not found:
+ tower.add_component(preload("res://Towers/Components/FrostComponent.gd").new())
+
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+
+func _on_burn_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ get_viewport().set_input_as_handled()
+
+ var towers = get_selected_towers()
+
+ var cost = 100 * towers.size()
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ var found = false
+ for idx in range(tower.components.size()):
+ var component = tower.components[idx]
+ if component.name == "Burn":
+ found = true
+ tower.remove_component(component.name)
+ break
+
+ if not found:
+ tower.add_component(preload("res://Towers/Components/BurnComponent.gd").new())
+
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+
+func _on_frost_level_up_pressed() -> void:
+ var towers = get_selected_towers()
+
+ var component: TowerComponent
+ for idx in range(current_tower.components.size()):
+ component = current_tower.components[idx]
+ if component.name == "Frost":
+ break
+
+ if not component:
+ return
+
+ var cost = 10 * component.level * towers.size()
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ var tower_component: TowerComponent
+ for idx in range(tower.components.size()):
+ tower_component = tower.components[idx]
+ if tower_component.name == "Frost":
+ break
+
+ tower_component.level += 1
+ tower.components_changed.emit()
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+
+func _on_burn_level_up_pressed() -> void:
+ var towers = get_selected_towers()
+
+ var component: TowerComponent
+ for idx in range(current_tower.components.size()):
+ component = current_tower.components[idx]
+ if component.name == "Burn":
+ break
+
+ if not component:
+ return
+
+ var cost = 10 * component.level * towers.size()
+ if Client.player.money < cost:
+ return
+
+ for tower: Tower in towers:
+ var tower_component: TowerComponent
+ for idx in range(tower.components.size()):
+ tower_component = tower.components[idx]
+ if tower_component.name == "Burn":
+ break
+
+ tower_component.level += 1
+ tower.components_changed.emit()
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
diff --git a/Stages/Wintermaul/hud_tower.tscn b/Stages/Wintermaul/hud_tower.tscn
new file mode 100644
index 0000000..ce9ebf9
--- /dev/null
+++ b/Stages/Wintermaul/hud_tower.tscn
@@ -0,0 +1,90 @@
+[gd_scene load_steps=4 format=3 uid="uid://ei0ai7om3mkw"]
+
+[ext_resource type="Texture2D" uid="uid://ba3dmlce1wv2p" path="res://Towers/Components/Assets/frost-component.png" id="1_1rlop"]
+[ext_resource type="Script" path="res://Stages/Wintermaul/hud_tower.gd" id="1_aog4m"]
+[ext_resource type="Texture2D" uid="uid://2djpswd6sgng" path="res://Towers/Components/Assets/burn-component.png" id="2_gcd2r"]
+
+[node name="HUDTower" type="VBoxContainer"]
+offset_left = 64.0
+offset_right = 140.0
+offset_bottom = 77.0
+script = ExtResource("1_aog4m")
+
+[node name="Data" type="Label" parent="."]
+unique_name_in_owner = true
+layout_mode = 2
+text = "Data"
+
+[node name="HBoxContainer" type="HBoxContainer" parent="."]
+layout_mode = 2
+
+[node name="RangePlus" type="Button" parent="HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+text = "+Range"
+
+[node name="PowerPlus" type="Button" parent="HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+text = "+Power"
+
+[node name="SpeedPlus" type="Button" parent="HBoxContainer"]
+unique_name_in_owner = true
+layout_mode = 2
+text = "+Speed"
+
+[node name="Components" type="VBoxContainer" parent="."]
+unique_name_in_owner = true
+layout_mode = 2
+
+[node name="Frost" type="HBoxContainer" parent="Components"]
+layout_mode = 2
+mouse_default_cursor_shape = 2
+
+[node name="TextureRect" type="TextureRect" parent="Components/Frost"]
+custom_minimum_size = Vector2(32, 0)
+layout_mode = 2
+texture = ExtResource("1_1rlop")
+stretch_mode = 5
+
+[node name="Label" type="Label" parent="Components/Frost"]
+layout_mode = 2
+text = "Frost"
+
+[node name="Level" type="Label" parent="Components/Frost"]
+layout_mode = 2
+text = ": 1"
+
+[node name="FrostLevelUp" type="Button" parent="Components/Frost"]
+layout_mode = 2
+text = "+Level"
+
+[node name="Burn" type="HBoxContainer" parent="Components"]
+layout_mode = 2
+mouse_default_cursor_shape = 2
+
+[node name="TextureRect" type="TextureRect" parent="Components/Burn"]
+custom_minimum_size = Vector2(32, 0)
+layout_mode = 2
+texture = ExtResource("2_gcd2r")
+stretch_mode = 5
+
+[node name="Label" type="Label" parent="Components/Burn"]
+layout_mode = 2
+text = "Burn"
+
+[node name="Level" type="Label" parent="Components/Burn"]
+layout_mode = 2
+text = ": 1"
+
+[node name="BurnLevelUp" type="Button" parent="Components/Burn"]
+layout_mode = 2
+text = "+Level"
+
+[connection signal="pressed" from="HBoxContainer/RangePlus" to="." method="_on_range_plus_pressed"]
+[connection signal="pressed" from="HBoxContainer/PowerPlus" to="." method="_on_power_plus_pressed"]
+[connection signal="pressed" from="HBoxContainer/SpeedPlus" to="." method="_on_speed_plus_pressed"]
+[connection signal="gui_input" from="Components/Frost" to="." method="_on_frost_gui_input"]
+[connection signal="pressed" from="Components/Frost/FrostLevelUp" to="." method="_on_frost_level_up_pressed"]
+[connection signal="gui_input" from="Components/Burn" to="." method="_on_burn_gui_input"]
+[connection signal="pressed" from="Components/Burn/BurnLevelUp" to="." method="_on_burn_level_up_pressed"]
diff --git a/Stages/Wintermaul/wintermaul.gd b/Stages/Wintermaul/wintermaul.gd
index e66a979..078edc6 100644
--- a/Stages/Wintermaul/wintermaul.gd
+++ b/Stages/Wintermaul/wintermaul.gd
@@ -18,6 +18,30 @@ var teams := Teams.new()
var income_frequency := 15.0
+var price_map = {
+ "tower": {
+ "cost": 5,
+ "attack_range": func(attack_range: int, number_of_towers: int = 1):
+ return (attack_range / 8.0) * 10 * number_of_towers
+ ,
+ "attack_power": func(attack_power: int, number_of_towers: int = 1):
+ return attack_power * 10 * number_of_towers
+ ,
+ "attack_speed": func(attack_speed: int, number_of_towers: int = 1):
+ return attack_speed * 10 * number_of_towers
+ ,
+ },
+
+ "unit": {
+ "tiers": [
+ {
+ "cost": 5,
+ "income": 1,
+ },
+ ],
+ },
+}
+
func _init():
super._init()
@@ -35,15 +59,15 @@ func _ready():
if multiplayer.is_server():
for player in Network.get_players():
Network.update_player.rpc(player.id, {
- "money": 50,
+ "money": 50 * 1000,
"income": 5,
})
# set camera limits
- $Camera.limit_left = $Map.get_used_rect().position.x * %Map.tile_set.tile_size.x - %Map.tile_set.tile_size.x
- $Camera.limit_right = $Map.get_used_rect().end.x * %Map.tile_set.tile_size.x - %Map.tile_set.tile_size.x
- $Camera.limit_top = %Map.get_used_rect().position.y * %Map.tile_set.tile_size.y
- $Camera.limit_bottom = %Map.get_used_rect().end.y * %Map.tile_set.tile_size.y
+ $Camera.limit_left = $Map.get_used_rect().position.x * %Map.tile_set.tile_size.x - %Map.tile_set.tile_size.x - 8 * %Map.tile_set.tile_size.y
+ $Camera.limit_right = $Map.get_used_rect().end.x * %Map.tile_set.tile_size.x - %Map.tile_set.tile_size.x + 8 * %Map.tile_set.tile_size.y
+ $Camera.limit_top = %Map.get_used_rect().position.y * %Map.tile_set.tile_size.y - 8 * %Map.tile_set.tile_size.y
+ $Camera.limit_bottom = %Map.get_used_rect().end.y * %Map.tile_set.tile_size.y + 8 * %Map.tile_set.tile_size.y
# add players to teams
Network.player_joined.connect(add_player)
@@ -67,12 +91,6 @@ func _ready():
# initialize lives display
update_lives("top", 0)
update_lives("bottom", 0)
-
- %HUD.attack_value_changed.connect(func(value: int):
- Network.update_player.rpc(Client.player.id, {
- "money": -(value * 10),
- })
- )
func _process(_delta: float) -> void: