diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-11-19 15:24:50 +0100 |
commit | 72863ffa31e27f4c6be862d80472cfb897fccaea (patch) | |
tree | ce04be8d77b10c797c8ff854c8ff1a219eb1af46 /Stages/Wintermaul/wintermaul.gd | |
parent | 63d2a59042fb9d90a586ad85d8364de7c38aea8e (diff) |
Diffstat (limited to 'Stages/Wintermaul/wintermaul.gd')
-rw-r--r-- | Stages/Wintermaul/wintermaul.gd | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/Stages/Wintermaul/wintermaul.gd b/Stages/Wintermaul/wintermaul.gd index 90abf6b..82170c7 100644 --- a/Stages/Wintermaul/wintermaul.gd +++ b/Stages/Wintermaul/wintermaul.gd @@ -38,29 +38,46 @@ var price_map = { "cost": 5, "income": 1, }, + { + "cost": 10, + "income": 3, + }, + { + "cost": 15, + "income": 5, + }, + { + "cost": 20, + "income": 7, + }, ], }, } +var starting_lives := 10 +var starting_money := 50 +var starting_income := 5 + func _init(): super._init() set_player_script(preload("res://Stages/Wintermaul/player.gd")) - - teams.top.lives = 10 - teams.bottom.lives = 10 func _ready(): super._ready() + # initialize team lives + teams.top.lives = starting_lives + teams.bottom.lives = starting_lives + # initialize player resources if multiplayer.is_server(): for player in Network.get_players(): Network.update_player.rpc(player.id, { - "money": 50 * 10000, - "income": 5, + "money": starting_money, + "income": starting_income, }) # set camera limits @@ -120,8 +137,19 @@ func spawn_unit(remote_data: Dictionary): var player = Network.get_player(unit.owner_id) player.units.append(unit) - player.money -= price_map.unit.tiers[0].cost - player.income += price_map.unit.tiers[0].income + # TODO: make better. create WintermaulUnit? instead of additional_data. + # TODO: potentially better price map as well with better idx access + #var tier_idx := 0 + #for idx in price_map.unit.tiers.size(): + #var tier = price_map.unit.tiers[idx] + #if tier.cost == unit.additional_data["cost"]: + #tier_idx = idx + #break + + #player.money -= price_map.unit.tiers[tier_idx].cost + #player.income += price_map.unit.tiers[tier_idx].income + player.money -= unit.unit_resource.cost + player.income += unit.unit_resource.income Network.players_changed.emit() if multiplayer.is_server(): |