summaryrefslogtreecommitdiff
path: root/Stages
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-10-10 13:16:33 +0200
committerDaniel Weipert <git@mail.dweipert.de>2024-10-10 13:16:33 +0200
commit911699e9563a8791d72173b46fd8860ce15bb91a (patch)
tree0f62aa539c5662a9cf3a432e83e571631fd3f586 /Stages
parent1aac583cee47d232ef22d8c5df97b888f689ab96 (diff)
intermediate commit
Diffstat (limited to 'Stages')
-rw-r--r--Stages/Stage.gd9
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)