From 026f05c958e1fbef3d3f00a2a7c347d341af5b6f Mon Sep 17 00:00:00 2001 From: informaniac Date: Fri, 1 Dec 2017 17:41:21 +0100 Subject: [PATCH] use the balance_util functions to determine if the player(s) are ready --- games/balancep0ng.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/games/balancep0ng.py b/games/balancep0ng.py index 4742949..01fd59f 100755 --- a/games/balancep0ng.py +++ b/games/balancep0ng.py @@ -144,8 +144,7 @@ class B4lancePong(object): print('connected!') balance_util_p1 = blup.balance_util.BalanceUtil(sock, 0) balance_util_p2 = blup.balance_util.BalanceUtil(sock, 1) - - while get_balance_from_sock(sock, 0) == -128: + while not balance_util_p1.get_player1_ready(): print('waiting for player...') time.sleep(1) @@ -160,8 +159,9 @@ class B4lancePong(object): self.__out.sendFrame(frame) print('waiting for second player...') - if get_balance_from_sock(sock, 1) > -128: - self.__players.append(BalanceBoardPlayer(self.__playground, self.__playground.rightPaddle, sock, 1)) + if balance_util_p2.get_player2_ready: + self.__players.append(BalanceBoardPlayer(self.__playground, self.__playground.rightPaddle, + balance_util_p2)) break time.sleep(1)