swapped the player's keys in local game mode

This commit is contained in:
CHIBOUB Chakib 2024-08-19 17:04:37 +02:00
parent f747e4a00f
commit de4829b47e

View File

@ -146,13 +146,13 @@ class Game:
return return
if self.localgame: if self.localgame:
if key == 'arrowup': if key == 'arrowup':
self.p1_mov = -1
elif key == 'arrowdown':
self.p1_mov = 1
elif key == 'w':
self.p2_mov = -1 self.p2_mov = -1
elif key == 's': elif key == 'arrowdown':
self.p2_mov = 1 self.p2_mov = 1
elif key == 'w':
self.p1_mov = -1
elif key == 's':
self.p1_mov = 1
elif player == self.player1: elif player == self.player1:
if key == 'arrowup': if key == 'arrowup':
self.p1_mov = -1 self.p1_mov = -1
@ -205,6 +205,7 @@ class Game:
}) })
await self.player1.send(end_message) await self.player1.send(end_message)
if not self.botgame: if not self.botgame:
if not self.localgame:
await self.player2.send(end_message) await self.player2.send(end_message)
print("save data") print("save data")
await endfortheouche(self.game_state['player1_name'], self.game_state['player2_name'], await endfortheouche(self.game_state['player1_name'], self.game_state['player2_name'],