From de4829b47e21bb20b5b0428d347f5bcbe4d711cc Mon Sep 17 00:00:00 2001 From: CHIBOUB Chakib Date: Mon, 19 Aug 2024 17:04:37 +0200 Subject: [PATCH] swapped the player's keys in local game mode --- pong/game/game.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pong/game/game.py b/pong/game/game.py index 23f9719..31048af 100644 --- a/pong/game/game.py +++ b/pong/game/game.py @@ -146,13 +146,13 @@ class Game: return if self.localgame: if key == 'arrowup': - self.p1_mov = -1 - elif key == 'arrowdown': - self.p1_mov = 1 - elif key == 'w': self.p2_mov = -1 - elif key == 's': + elif key == 'arrowdown': self.p2_mov = 1 + elif key == 'w': + self.p1_mov = -1 + elif key == 's': + self.p1_mov = 1 elif player == self.player1: if key == 'arrowup': self.p1_mov = -1 @@ -205,7 +205,8 @@ class Game: }) await self.player1.send(end_message) if not self.botgame: - await self.player2.send(end_message) + if not self.localgame: + await self.player2.send(end_message) print("save data") await endfortheouche(self.game_state['player1_name'], self.game_state['player2_name'], self.game_state['player1_score'], self.game_state['player2_score'],