|
|
@ -249,13 +249,23 @@ class BalanceTtrsPlayer(TtrsPlayer, threading.Thread): |
|
|
|
oldevt = None |
|
|
|
oldevt = None |
|
|
|
lastchange = 0 |
|
|
|
lastchange = 0 |
|
|
|
while self.running: |
|
|
|
while self.running: |
|
|
|
|
|
|
|
THRESHOLD = 40 |
|
|
|
|
|
|
|
direction = self.balance_util.get_4dir(THRESHOLD) |
|
|
|
|
|
|
|
|
|
|
|
#print('player_id=%d xbal=%d ybal=%d' % (self.player_id, xbal, ybal)) |
|
|
|
if direction == blup.balance_util.Direction.QUIT: |
|
|
|
self.evt = PlayerEvent.QUIT |
|
|
|
self.evt = PlayerEvent.QUIT |
|
|
|
|
|
|
|
elif direction == blup.balance_util.Direction.LEFT: |
|
|
|
THRESHOLD = 40 |
|
|
|
evt = PlayerEvent.MOVE_LEFT |
|
|
|
|
|
|
|
elif direction == blup.balance_util.Direction.RIGHT: |
|
|
|
|
|
|
|
evt = PlayerEvent.MOVE_RIGHT |
|
|
|
|
|
|
|
elif direction == blup.balance_util.Direction.UP: |
|
|
|
|
|
|
|
evt = PlayerEvent.ROTATE |
|
|
|
|
|
|
|
elif direction == blup.balance_util.Direction.DOWN: |
|
|
|
|
|
|
|
evt = PlayerEvent.DOWN |
|
|
|
else: |
|
|
|
else: |
|
|
|
|
|
|
|
evt = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#print('player_id=%d xbal=%d ybal=%d' % (self.player_id, xbal, ybal)) |
|
|
|
MIN_TIMES = { |
|
|
|
MIN_TIMES = { |
|
|
|
PlayerEvent.MOVE_LEFT: 0.1, |
|
|
|
PlayerEvent.MOVE_LEFT: 0.1, |
|
|
|
PlayerEvent.MOVE_RIGHT: 0.1, |
|
|
|
PlayerEvent.MOVE_RIGHT: 0.1, |
|
|
|