Browse Source

player information is now retrieved from the balance_util

feature/balanceutils
informaniac 7 years ago
parent
commit
075e8c5c03
  1. 6
      games/balancep0ng.py

6
games/balancep0ng.py

@ -94,8 +94,8 @@ class BalanceBoardPlayer(object):
bal = self.__balance_util.get_raw_2dir_y() bal = self.__balance_util.get_raw_2dir_y()
if bal == -128: if bal == -128:
print("player %d has quit" % (self.__player_id)) print("player %d has quit" % self.__balance_util.player_id)
self.__wiimote_sock.close() self.__balance_util.socket.close()
sys.exit(1) sys.exit(1)
bal = -bal bal = -bal
@ -107,7 +107,7 @@ class BalanceBoardPlayer(object):
bal += MAX_AMPLITUDE bal += MAX_AMPLITUDE
pos = int((bal / (2 * MAX_AMPLITUDE)) * self.__playground.height) pos = int((bal / (2 * MAX_AMPLITUDE)) * self.__playground.height)
print("player %d pos=%d" % (self.__player_id, pos)) print("player %d pos=%d" % self.__balance_util.player_id, pos)
if self.__ownPaddle.ypos > pos: if self.__ownPaddle.ypos > pos:
self.__ownPaddle.nextMoveUp() self.__ownPaddle.nextMoveUp()

Loading…
Cancel
Save