diff options
author | Daniel Weipert <code@drogueronin.de> | 2021-01-22 16:40:46 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2021-01-22 16:40:46 +0100 |
commit | 3f4c07d2cf57bd364af6b09a3d5381d148aa713e (patch) | |
tree | 4fe53d2f627237e70a24ff7ec3d3815d07523c62 /Global.gd | |
parent | 485cd463b22e12394cd232812e2c3789ef37ab1c (diff) |
New Characters! New Levels!
Diffstat (limited to 'Global.gd')
-rw-r--r-- | Global.gd | 38 |
1 files changed, 30 insertions, 8 deletions
@@ -7,16 +7,16 @@ signal game_ended() signal game_won() -const Levels = [ - "Level_0001", - "Level_0001", - "Level_0001", - "Level_0001", - "Level_0001", - "Level_0001", +var Levels = [ "Level_0001", + "Level_0002", + "Level_0003", "Level_0001", + "Level_0002", + "Level_0003", "Level_0001", + "Level_0002", + "Level_0003", ] var Level_Map = [] @@ -30,6 +30,9 @@ func _ready(): func init(): + randomize() + self.Levels.shuffle() + for level in self.Levels: self.Level_Map.push_back({ time = 0, @@ -116,7 +119,7 @@ func _on_Network_game_ended(winning_player): self.init() -func check_win(): +func has_won(): var has_won = false var cleared_levels_idx = [] @@ -148,5 +151,24 @@ func check_win(): has_won = true break + return has_won + + +func check_win(): + var has_won = self.has_won() + + if has_won: + # TODO: start 10s timer with callback check_win_timer() + # SAVE IN REMOTE ARRAY USERS WITH CROWN = rpc_id + running timer? + # Check for each user that already has a crown if the win condition is still true + # if it's not, delete user from array and stop timer + # if it is, do nothing, keep running until game end + self.check_win_timer() + pass + + +func check_win_timer(): + var has_won = self.has_won() + if has_won: emit_signal("game_won", Network.player) |