diff options
Diffstat (limited to 'Stages')
-rw-r--r-- | Stages/Stage.gd | 9 |
1 files changed, 7 insertions, 2 deletions
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) |