diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-06 22:35:04 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-06 22:35:04 +0100 |
commit | 63d2a59042fb9d90a586ad85d8364de7c38aea8e (patch) | |
tree | f4c648b39313f10f44898d0216a9147dfb4ba491 /Stages | |
parent | f20b3a48a14f34def41d823fabb476981ef7055e (diff) |
next commit
Diffstat (limited to 'Stages')
-rw-r--r-- | Stages/Wintermaul/HUD.gd | 2 | ||||
-rw-r--r-- | Stages/Wintermaul/hud_tower.gd | 33 | ||||
-rw-r--r-- | Stages/Wintermaul/hud_tower.tscn | 1 |
3 files changed, 26 insertions, 10 deletions
diff --git a/Stages/Wintermaul/HUD.gd b/Stages/Wintermaul/HUD.gd index be2dacb..1033c8e 100644 --- a/Stages/Wintermaul/HUD.gd +++ b/Stages/Wintermaul/HUD.gd @@ -104,6 +104,8 @@ func _ready(): ) tower.selection_group_id_changed.connect(func(previous_id: String): + #Client.selection.change_selection_group_id([tower], previous_id, tower.selection_group_id) + if not tower.selection_group_id in selection_groups: selection_groups[tower.selection_group_id] = [] selection_groups[tower.selection_group_id].append(tower) diff --git a/Stages/Wintermaul/hud_tower.gd b/Stages/Wintermaul/hud_tower.gd index 24a7a8d..99d9e62 100644 --- a/Stages/Wintermaul/hud_tower.gd +++ b/Stages/Wintermaul/hud_tower.gd @@ -17,9 +17,12 @@ func set_current_tower(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 - #] + + %Data.text = "Range: %s - Power: %s - Speed: %s" % [ + current_tower.components.get(TowerComponent.ComponentType.Range).range, + current_tower.components.get(TowerComponent.ComponentType.Attack).power, + current_tower.components.get(TowerComponent.ComponentType.Attack).speed, + ] func redraw_components(): @@ -131,7 +134,7 @@ func _on_range_gui_input(event: InputEvent) -> void: return for tower: Tower in towers: - tower.add_component(preload("res://Towers/Components/RangeComponent.gd").new()) + tower.add_component(preload("res://Towers/Components/RangeComponent.tscn").instantiate()) Client.update_tower(tower.get_path(), tower.to_network_data()) @@ -156,7 +159,7 @@ func _on_attack_gui_input(event: InputEvent) -> void: return for tower: Tower in towers: - tower.add_component(preload("res://Towers/Components/AttackComponent.gd").new()) + tower.add_component(preload("res://Towers/Components/AttackComponent.tscn").instantiate()) Client.update_tower(tower.get_path(), tower.to_network_data()) @@ -181,7 +184,7 @@ func _on_frost_gui_input(event: InputEvent) -> void: return for tower: Tower in towers: - tower.add_component(preload("res://Towers/Components/FrostComponent.gd").new()) + tower.add_component(preload("res://Towers/Components/FrostComponent.tscn").instantiate()) Client.update_tower(tower.get_path(), tower.to_network_data()) @@ -206,7 +209,7 @@ func _on_burn_gui_input(event: InputEvent) -> void: return for tower: Tower in towers: - tower.add_component(preload("res://Towers/Components/BurnComponent.gd").new()) + tower.add_component(preload("res://Towers/Components/BurnComponent.tscn").instantiate()) Client.update_tower(tower.get_path(), tower.to_network_data()) @@ -223,7 +226,7 @@ func _on_range_level_up_pressed() -> void: if not component: return - var cost = 25 * component.level * towers.size() + var cost = pow(5, component.level) * towers.size() if Client.player.money < cost: Client.current_stage.add_status_message("Not enough money to level up") return @@ -239,6 +242,12 @@ func _on_range_level_up_pressed() -> void: Network.update_player.rpc(Client.player.id, { "money": -cost, }) + + %Data.text = "Range: %s - Power: %s - Speed: %s" % [ + current_tower.components.get(TowerComponent.ComponentType.Range).range, + current_tower.components.get(TowerComponent.ComponentType.Attack).power, + current_tower.components.get(TowerComponent.ComponentType.Attack).speed, + ] func _on_attack_level_up_pressed() -> void: @@ -265,6 +274,12 @@ func _on_attack_level_up_pressed() -> void: Network.update_player.rpc(Client.player.id, { "money": -cost, }) + + %Data.text = "Range: %s - Power: %s - Speed: %s" % [ + current_tower.components.get(TowerComponent.ComponentType.Range).range, + current_tower.components.get(TowerComponent.ComponentType.Attack).power, + current_tower.components.get(TowerComponent.ComponentType.Attack).speed, + ] func _on_frost_level_up_pressed() -> void: @@ -349,7 +364,7 @@ func _on_range_level_up_mouse_entered() -> void: return var towers = get_selected_towers() - var cost = 25 * component.level * towers.size() + var cost = pow(5, component.level) * towers.size() $Components/Range/RangeLevelUp.tooltip_text = "Cost: " + str(cost) func _on_attack_mouse_entered() -> void: diff --git a/Stages/Wintermaul/hud_tower.tscn b/Stages/Wintermaul/hud_tower.tscn index 4a23f10..e8c6487 100644 --- a/Stages/Wintermaul/hud_tower.tscn +++ b/Stages/Wintermaul/hud_tower.tscn @@ -14,7 +14,6 @@ script = ExtResource("1_aog4m") [node name="Data" type="Label" parent="."] unique_name_in_owner = true -visible = false layout_mode = 2 text = "Data" |