summaryrefslogtreecommitdiff
path: root/Stages/Wintermaul
diff options
context:
space:
mode:
Diffstat (limited to 'Stages/Wintermaul')
-rw-r--r--Stages/Wintermaul/HUD.gd2
-rw-r--r--Stages/Wintermaul/HUD.tscn13
-rw-r--r--Stages/Wintermaul/Units/pekora.tres12
-rw-r--r--Stages/Wintermaul/hud_tower.gd73
-rw-r--r--Stages/Wintermaul/hud_tower.tscn30
-rw-r--r--Stages/Wintermaul/unit_resource.gd6
-rw-r--r--Stages/Wintermaul/wintermaul.gd42
7 files changed, 166 insertions, 12 deletions
diff --git a/Stages/Wintermaul/HUD.gd b/Stages/Wintermaul/HUD.gd
index 1033c8e..34fc0ea 100644
--- a/Stages/Wintermaul/HUD.gd
+++ b/Stages/Wintermaul/HUD.gd
@@ -123,7 +123,7 @@ func _ready():
)
)
- Client.multi_select_finished.connect(func():
+ Client.multi_select_finished.connect(func(_nodes):
var keys = get_ordered_group_keys()
if keys.size() > 0:
selected_group = keys[0]
diff --git a/Stages/Wintermaul/HUD.tscn b/Stages/Wintermaul/HUD.tscn
index 3290c84..1a2fd11 100644
--- a/Stages/Wintermaul/HUD.tscn
+++ b/Stages/Wintermaul/HUD.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=38 format=3 uid="uid://bylx30cweulmk"]
+[gd_scene load_steps=39 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://UI/Assets/Icons/tilemap_white.png" id="2_dyehp"]
@@ -19,6 +19,7 @@
[ext_resource type="SpriteFrames" uid="uid://c6o6hpltnsds0" path="res://Units/Assets/Pekora/sprite_frames.tres" id="14_0x0h2"]
[ext_resource type="Texture2D" uid="uid://dr02nqmrnciy0" path="res://Units/Assets/mob.png" id="14_t3qlu"]
[ext_resource type="Texture2D" uid="uid://uy7jqeqnemvv" path="res://Units/Assets/NinomaeInanis/menu.png" id="15_7yrxb"]
+[ext_resource type="Resource" uid="uid://reijb7spqqwc" path="res://Stages/Wintermaul/Units/pekora.tres" id="15_81ek8"]
[ext_resource type="Texture2D" uid="uid://drpox2degox52" path="res://Units/Assets/NinomaeInanis/menu_pressed.png" id="16_77ajg"]
[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"]
@@ -348,6 +349,8 @@ texture_pressed = ExtResource("11_muxro")
texture_hover = ExtResource("12_540qu")
texture = ExtResource("7_ba5tw")
sprite_sheet = ExtResource("14_0x0h2")
+speed = 50
+unit_resource = ExtResource("15_81ek8")
[node name="SpawnButton2" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
layout_mode = 2
@@ -357,6 +360,9 @@ texture_pressed = ExtResource("16_77ajg")
texture_hover = ExtResource("17_k5kqo")
texture = ExtResource("9_nmd8t")
sprite_sheet = ExtResource("17_hp6oc")
+cost = 10
+hp = 10
+speed = 50
[node name="SpawnButton3" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
layout_mode = 2
@@ -365,6 +371,8 @@ texture_pressed = ExtResource("21_4fyiv")
texture_hover = ExtResource("22_471yj")
texture = ExtResource("11_yxcwt")
sprite_sheet = ExtResource("20_xc6s7")
+cost = 15
+hp = 10
[node name="SpawnButton4" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
layout_mode = 2
@@ -373,6 +381,9 @@ texture_pressed = ExtResource("26_tgyag")
texture_hover = ExtResource("27_5tp6y")
texture = ExtResource("13_iq5a7")
sprite_sheet = ExtResource("29_p4pru")
+cost = 20
+hp = 15
+speed = 150
[node name="SpawnButton5" parent="MarginContainer/VBoxContainer/HBoxContainer/SpawnBox/MarginContainer/GridContainer" instance=ExtResource("3_7eaea")]
layout_mode = 2
diff --git a/Stages/Wintermaul/Units/pekora.tres b/Stages/Wintermaul/Units/pekora.tres
new file mode 100644
index 0000000..d3147a6
--- /dev/null
+++ b/Stages/Wintermaul/Units/pekora.tres
@@ -0,0 +1,12 @@
+[gd_resource type="Resource" script_class="WintermaulUnitResource" load_steps=3 format=3 uid="uid://reijb7spqqwc"]
+
+[ext_resource type="Script" path="res://Stages/Wintermaul/unit_resource.gd" id="1_mf0dx"]
+[ext_resource type="SpriteFrames" uid="uid://c6o6hpltnsds0" path="res://Units/Assets/Pekora/sprite_frames.tres" id="2_luuh7"]
+
+[resource]
+script = ExtResource("1_mf0dx")
+cost = 5
+income = 1
+sprite_frames = ExtResource("2_luuh7")
+hp = 5
+speed = 50.0
diff --git a/Stages/Wintermaul/hud_tower.gd b/Stages/Wintermaul/hud_tower.gd
index 99d9e62..2c92a11 100644
--- a/Stages/Wintermaul/hud_tower.gd
+++ b/Stages/Wintermaul/hud_tower.gd
@@ -218,6 +218,31 @@ func _on_burn_gui_input(event: InputEvent) -> void:
})
+func _on_poison_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("select"):
+ get_viewport().set_input_as_handled()
+
+ if current_tower.components.has(TowerComponent.ComponentType.Poison):
+ Client.current_stage.add_status_message("Component already added")
+ return
+
+ var towers = get_selected_towers()
+
+ var cost = 100 * towers.size()
+ if Client.player.money < cost:
+ Client.current_stage.add_status_message("Not enough money to add component")
+ return
+
+ for tower: Tower in towers:
+ tower.add_component(preload("res://Towers/Components/PoisonComponent.tscn").instantiate())
+
+ Client.update_tower(tower.get_path(), tower.to_network_data())
+
+ Network.update_player.rpc(Client.player.id, {
+ "money": -cost,
+ })
+
+
func _on_range_level_up_pressed() -> void:
var towers = get_selected_towers()
@@ -333,6 +358,31 @@ func _on_burn_level_up_pressed() -> void:
})
+func _on_poison_level_up_pressed() -> void:
+ var towers = get_selected_towers()
+
+ var component: TowerComponent = current_tower.components.get(TowerComponent.ComponentType.Poison)
+ if not component:
+ return
+
+ var cost = 10 * component.level * towers.size()
+ if Client.player.money < cost:
+ Client.current_stage.add_status_message("Not enough money to level up")
+ return
+
+ for tower: Tower in towers:
+ var tower_component: TowerComponent = tower.components.get(TowerComponent.ComponentType.Poison)
+
+ 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_range_plus_mouse_entered() -> void:
#var towers = get_selected_towers()
#var cost = Client.current_stage.price_map.tower.attack_range.call(current_tower.attack_range, towers.size())
@@ -369,7 +419,7 @@ func _on_range_level_up_mouse_entered() -> void:
func _on_attack_mouse_entered() -> void:
if current_tower.components.has(TowerComponent.ComponentType.Attack):
- $Components/Range.tooltip_text = ""
+ $Components/Attack.tooltip_text = ""
return
var towers = get_selected_towers()
@@ -388,7 +438,7 @@ func _on_attack_level_up_mouse_entered() -> void:
func _on_frost_mouse_entered() -> void:
if current_tower.components.has(TowerComponent.ComponentType.Frost):
- $Components/Range.tooltip_text = ""
+ $Components/Frost.tooltip_text = ""
return
var towers = get_selected_towers()
@@ -423,3 +473,22 @@ func _on_burn_level_up_mouse_entered() -> void:
var towers = get_selected_towers()
var cost = 10 * component.level * towers.size()
$Components/Burn/BurnLevelUp.tooltip_text = "Cost: " + str(cost)
+
+func _on_poison_mouse_entered() -> void:
+ if current_tower.components.has(TowerComponent.ComponentType.Poison):
+ $Components/Poison.tooltip_text = ""
+ return
+
+ var towers = get_selected_towers()
+ var cost = 100 * towers.size()
+ $Components/Poison.tooltip_text = "Cost: " + str(cost)
+
+func _on_poison_level_up_mouse_entered() -> void:
+ var component = current_tower.components.get(TowerComponent.ComponentType.Poison)
+ if not component:
+ $Components/Poison/PoisonLevelUp.tooltip_text = ""
+ return
+
+ var towers = get_selected_towers()
+ var cost = 10 * component.level * towers.size()
+ $Components/Poison/PoisonLevelUp.tooltip_text = "Cost: " + str(cost)
diff --git a/Stages/Wintermaul/hud_tower.tscn b/Stages/Wintermaul/hud_tower.tscn
index e8c6487..b31f6a8 100644
--- a/Stages/Wintermaul/hud_tower.tscn
+++ b/Stages/Wintermaul/hud_tower.tscn
@@ -1,10 +1,11 @@
-[gd_scene load_steps=6 format=3 uid="uid://ei0ai7om3mkw"]
+[gd_scene load_steps=7 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://dx07y4scyi5a1" path="res://Towers/Components/Assets/range-component.png" id="2_epopi"]
[ext_resource type="Texture2D" uid="uid://2djpswd6sgng" path="res://Towers/Components/Assets/burn-component.png" id="2_gcd2r"]
[ext_resource type="Texture2D" uid="uid://gbknvb38euuq" path="res://Towers/Components/Assets/attack-component.png" id="3_xygpi"]
+[ext_resource type="Texture2D" uid="uid://rkeldjv41ww8" path="res://Towers/Components/Assets/poison-component.png" id="6_0uft1"]
[node name="HUDTower" type="VBoxContainer"]
offset_left = 64.0
@@ -135,6 +136,29 @@ layout_mode = 2
mouse_default_cursor_shape = 2
text = "+Level"
+[node name="Poison" type="HBoxContainer" parent="Components"]
+layout_mode = 2
+mouse_default_cursor_shape = 2
+
+[node name="TextureRect" type="TextureRect" parent="Components/Poison"]
+custom_minimum_size = Vector2(32, 0)
+layout_mode = 2
+texture = ExtResource("6_0uft1")
+stretch_mode = 5
+
+[node name="Label" type="Label" parent="Components/Poison"]
+layout_mode = 2
+text = "Poison"
+
+[node name="Level" type="Label" parent="Components/Poison"]
+layout_mode = 2
+text = ": 1"
+
+[node name="PoisonLevelUp" type="Button" parent="Components/Poison"]
+layout_mode = 2
+mouse_default_cursor_shape = 2
+text = "+Level"
+
[connection signal="mouse_entered" from="HBoxContainer/RangePlus" to="." method="_on_range_plus_mouse_entered"]
[connection signal="pressed" from="HBoxContainer/RangePlus" to="." method="_on_range_plus_pressed"]
[connection signal="mouse_entered" from="HBoxContainer/PowerPlus" to="." method="_on_power_plus_mouse_entered"]
@@ -157,3 +181,7 @@ text = "+Level"
[connection signal="mouse_entered" from="Components/Burn" to="." method="_on_burn_mouse_entered"]
[connection signal="mouse_entered" from="Components/Burn/BurnLevelUp" to="." method="_on_burn_level_up_mouse_entered"]
[connection signal="pressed" from="Components/Burn/BurnLevelUp" to="." method="_on_burn_level_up_pressed"]
+[connection signal="gui_input" from="Components/Poison" to="." method="_on_poison_gui_input"]
+[connection signal="mouse_entered" from="Components/Poison" to="." method="_on_poison_mouse_entered"]
+[connection signal="mouse_entered" from="Components/Poison/PoisonLevelUp" to="." method="_on_poison_level_up_mouse_entered"]
+[connection signal="pressed" from="Components/Poison/PoisonLevelUp" to="." method="_on_poison_level_up_pressed"]
diff --git a/Stages/Wintermaul/unit_resource.gd b/Stages/Wintermaul/unit_resource.gd
new file mode 100644
index 0000000..3f759ab
--- /dev/null
+++ b/Stages/Wintermaul/unit_resource.gd
@@ -0,0 +1,6 @@
+class_name WintermaulUnitResource
+extends UnitResource
+
+
+@export var cost: int
+@export var income: int
diff --git a/Stages/Wintermaul/wintermaul.gd b/Stages/Wintermaul/wintermaul.gd
index 90abf6b..82170c7 100644
--- a/Stages/Wintermaul/wintermaul.gd
+++ b/Stages/Wintermaul/wintermaul.gd
@@ -38,29 +38,46 @@ var price_map = {
"cost": 5,
"income": 1,
},
+ {
+ "cost": 10,
+ "income": 3,
+ },
+ {
+ "cost": 15,
+ "income": 5,
+ },
+ {
+ "cost": 20,
+ "income": 7,
+ },
],
},
}
+var starting_lives := 10
+var starting_money := 50
+var starting_income := 5
+
func _init():
super._init()
set_player_script(preload("res://Stages/Wintermaul/player.gd"))
-
- teams.top.lives = 10
- teams.bottom.lives = 10
func _ready():
super._ready()
+ # initialize team lives
+ teams.top.lives = starting_lives
+ teams.bottom.lives = starting_lives
+
# initialize player resources
if multiplayer.is_server():
for player in Network.get_players():
Network.update_player.rpc(player.id, {
- "money": 50 * 10000,
- "income": 5,
+ "money": starting_money,
+ "income": starting_income,
})
# set camera limits
@@ -120,8 +137,19 @@ func spawn_unit(remote_data: Dictionary):
var player = Network.get_player(unit.owner_id)
player.units.append(unit)
- player.money -= price_map.unit.tiers[0].cost
- player.income += price_map.unit.tiers[0].income
+ # TODO: make better. create WintermaulUnit? instead of additional_data.
+ # TODO: potentially better price map as well with better idx access
+ #var tier_idx := 0
+ #for idx in price_map.unit.tiers.size():
+ #var tier = price_map.unit.tiers[idx]
+ #if tier.cost == unit.additional_data["cost"]:
+ #tier_idx = idx
+ #break
+
+ #player.money -= price_map.unit.tiers[tier_idx].cost
+ #player.income += price_map.unit.tiers[tier_idx].income
+ player.money -= unit.unit_resource.cost
+ player.income += unit.unit_resource.income
Network.players_changed.emit()
if multiplayer.is_server():