From 6db6465d1b938ec494cd66c9984bff5cc14bde11 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 20 Oct 2024 12:09:48 +0200 Subject: next commit --- Game/Client.gd | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'Game/Client.gd') diff --git a/Game/Client.gd b/Game/Client.gd index 60efbb8..98a8e6c 100644 --- a/Game/Client.gd +++ b/Game/Client.gd @@ -3,6 +3,10 @@ extends Node signal stage_state_changed(state: State) +@warning_ignore("unused_signal") +signal placed_tower(tower: Tower) + + var state: State : set(value): state = value @@ -31,6 +35,14 @@ func place_tower(tower: Tower): tower.owner_id = network_id tower.name = "Tower@" + str(network_id) + "@" + str(Time.get_ticks_usec()) + tower.attack_range = [ + current_stage.map.tile_set.tile_size.x * 2, + current_stage.map.tile_set.tile_size.x * 3, + current_stage.map.tile_set.tile_size.x * 4, + ].pick_random() + tower.attack_power = [1, 2, 3, 4].pick_random() + tower.attack_speed = [1, 2, 3, 4].pick_random() + current_stage.place_tower.rpc(inst_to_dict(tower.to_network_data())) @@ -41,7 +53,7 @@ func remove_tower(tower: Tower): func destroy_tower(tower: Tower): current_stage.destroy_tower(tower) - Network.destroy_tower.rpc(tower.global_position) + Network.destroy_tower.rpc(inst_to_dict(tower.to_network_data())) player.towers.erase(tower.global_position) @@ -51,10 +63,14 @@ func select_tower(tower: Tower): tower.is_selected = true -func deselect_tower(): - if not Tower.selected_towers.is_empty(): - for tower in Tower.selected_towers: - tower.is_selected = false +func multi_select(layer: int): + var selection_area = preload("res://Game/Selection/MultiSelectArea.tscn").instantiate() + selection_area.set_collision_mask_value(layer, true) + selection_area.select.connect(func(nodes): + for node in nodes: + Client.select_tower(node) + ) + get_tree().current_scene.add_child(selection_area) func update_tower(path: NodePath, data: Tower.NetworkData): @@ -71,8 +87,8 @@ func spawn_unit(unit: Unit, spawn: Spawn, overwrite_target: PathNode = null): unit.global_position = spawn.spawn_position unit.target = spawn.next_node - unit.hp = randi_range(50, 150) #20000b - unit.speed = randi_range(100, 150) + unit.hp = randi_range(5, 10) #20000b + unit.speed = randi_range(50, 150) if overwrite_target: unit.target = overwrite_target -- cgit v1.2.3