add leave request when the opponent leaves the game
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/09/13 16:20:58 by tomoron #+# #+# #
|
||||
# Updated: 2024/09/17 00:07:47 by edbernar ### ########.fr #
|
||||
# Updated: 2024/09/17 12:53:12 by tomoron ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -27,6 +27,11 @@ class Game:
|
||||
self.playerLeft = False
|
||||
self.end = False
|
||||
|
||||
self.player1Pos = {"pos":0, "up": False)
|
||||
self.player1Pos = {"pos":0, "up": False)
|
||||
|
||||
self.ballPos = {"pos":(0, 0), "up", False)
|
||||
|
||||
if(withBot):
|
||||
self.join(socket)
|
||||
else:
|
||||
@ -75,6 +80,10 @@ class Game:
|
||||
elif(socket == self.p2):
|
||||
self.p2 = None
|
||||
self.p2Ready =False
|
||||
if(self.p1 != None):
|
||||
self.p2.sync_send({"type":"game","content":{"action":4}})
|
||||
if(self.p2 != None):
|
||||
self.p1.sync_send({"type":"game","content":{"action":4}})
|
||||
if(not self.started):
|
||||
while(Game.waitingForPlayerLock):
|
||||
time.sleep(0.05)
|
||||
|
@ -6,7 +6,7 @@
|
||||
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2024/09/09 16:10:26 by tomoron #+# #+# #
|
||||
# Updated: 2024/09/16 13:59:24 by tomoron ### ########.fr #
|
||||
# Updated: 2024/09/16 16:31:10 by tomoron ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -30,6 +30,8 @@ from .gameActions.move import move
|
||||
# - is_opponent
|
||||
# - pos
|
||||
# - up
|
||||
#
|
||||
# 4 : leave : when the opponent left the game
|
||||
|
||||
#client actions (actions sent by the client) :
|
||||
# 0 : start : starts a game
|
||||
|
Reference in New Issue
Block a user