sevivon

[DORMANT] multiplayer dreidel game for mobile devices w/ godot
git clone git://git.figbert.com/sevivon.git
Log | Files | Refs | README | LICENSE

commit bc223df2b4ee6ea24efa6d8e24079ce720ae2821
parent 19d0d3e83400afaa0c4a791619f794a975589393
Author: FIGBERT <figbert@figbert.com>
Date:   Fri, 12 Feb 2021 12:52:37 -0800

Merge Winner and Utility Function sections

Diffstat:
Msrc/scripts/main.gd | 29++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/scripts/main.gd b/src/scripts/main.gd @@ -179,21 +179,6 @@ func _iterate_turn() -> void: rpc("print_message_from_server", "It's now %s's turn" % username) -### Winner -func _check_for_winner() -> bool: - var sum := 0 - for id in players.keys(): - sum += int(players[id]["in"]) - return true if sum == 1 else false - - -func _find_winner() -> int: - for id in players.keys(): - if players[id]["in"]: - return id - return -1 - - ## Client Logic func _initialize_client() -> void: var peer := NetworkedMultiplayerENet.new() @@ -228,6 +213,20 @@ remote func vibrate_device() -> void: ## Utility Functions +func _check_for_winner() -> bool: + var sum := 0 + for id in players.keys(): + sum += int(players[id]["in"]) + return true if sum == 1 else false + + +func _find_winner() -> int: + for id in players.keys(): + if players[id]["in"]: + return id + return -1 + + func _gelt_status() -> String: var message := "Current gelt status:\n Pot: %s\n" % pot for id in players.keys():