From 911699e9563a8791d72173b46fd8860ce15bb91a Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 10 Oct 2024 13:16:33 +0200 Subject: intermediate commit --- Stages/Stage.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Stages') diff --git a/Stages/Stage.gd b/Stages/Stage.gd index 1f73a09..47f42a2 100644 --- a/Stages/Stage.gd +++ b/Stages/Stage.gd @@ -37,18 +37,23 @@ func _ready() -> void: func place_tower(tower: Tower, position: Vector2): - var player: Player = Network.players[tower.owner_id] + var player: Player = Network.get_player(tower.owner_id) tower.get_node("Sprite2D").modulate = player.get_color() tower.get_node("ComponentsAnchor").modulate = player.get_color() tower.global_position = position fill_tower_region(tower, true) towers.add_child(tower, true) + + player.score += 1 func destroy_tower(tower: Tower): fill_tower_region(tower, false) tower.queue_free() + + var player: Player = Network.get_player(tower.owner_id) + player.score -= 1 func fill_tower_region(tower: Tower, solid = true): @@ -75,7 +80,7 @@ func fill_tower_region(tower: Tower, solid = true): @warning_ignore("shadowed_variable") func spawn_unit(unit: Unit):#, _spawn: Spawn): - var player: Player = Network.players[unit.owner_id] + var player: Player = Network.get_player(unit.owner_id) unit.get_node("Sprite2D").modulate = player.get_color() units.add_child(unit, true) -- cgit v1.2.3