change identifications of jumpers in request 8, when the ball jumps

This commit is contained in:
2024-09-27 17:54:09 +02:00
parent fcf49cde52
commit bc80836329
2 changed files with 13 additions and 13 deletions

View File

@ -6,7 +6,7 @@
# By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ # # By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/09/13 16:20:58 by tomoron #+# #+# # # Created: 2024/09/13 16:20:58 by tomoron #+# #+# #
# Updated: 2024/09/27 17:36:06 by tomoron ### ########.fr # # Updated: 2024/09/27 17:51:24 by tomoron ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -37,14 +37,14 @@ class Game:
{ "type":2, "pos": {"x": -1, "y": 0, "z": 1}, "isUp": True} { "type":2, "pos": {"x": -1, "y": 0, "z": 1}, "isUp": True}
] ]
jumpersPos = [ jumpersPos = [
{ "type":1, "pos":{"x": -1.5, "y": 0.2, "z":mapLength/4}, "isUp": False }, { "type":1, "name":"J0", "pos":{"x": -1.5, "y": 0.2, "z":mapLength/4}, "isUp": False },
{ "type":1, "pos":{"x": -1.5, "y": 3.2, "z": mapLength / 4}, "isUp": True }, { "type":1, "name":"J1", "pos":{"x": -1.5, "y": 3.2, "z": mapLength / 4}, "isUp": True },
{ "type":1, "pos":{"x": 1.5, "y": 0.2, "z": mapLength / 4}, "isUp": False }, { "type":1, "name":"J2", "pos":{"x": 1.5, "y": 0.2, "z": mapLength / 4}, "isUp": False },
{ "type":1, "pos":{"x": 1.5, "y": 3.2, "z": mapLength / 4}, "isUp": True }, { "type":1, "name":"J3", "pos":{"x": 1.5, "y": 3.2, "z": mapLength / 4}, "isUp": True },
{ "type":1, "pos":{"x": -1.5, "y": 0.2, "z": -mapLength / 4}, "isUp": False }, { "type":1, "name":"J4", "pos":{"x": -1.5, "y": 0.2, "z": -mapLength / 4}, "isUp": False },
{ "type":1, "pos":{"x": -1.5, "y": 3.2, "z": -mapLength / 4}, "isUp": True }, { "type":1, "name":"J5", "pos":{"x": -1.5, "y": 3.2, "z": -mapLength / 4}, "isUp": True },
{ "type":1, "pos":{"x": 1.5, "y": 0.2, "z": -mapLength / 4}, "isUp": False }, { "type":1, "name":"J6", "pos":{"x": 1.5, "y": 0.2, "z": -mapLength / 4}, "isUp": False },
{ "type":1, "pos":{"x": 1.5, "y": 3.2, "z": -mapLength / 4}, "isUp": True } { "type":1, "name":"J7", "pos":{"x": 1.5, "y": 3.2, "z": -mapLength / 4}, "isUp": True }
] ]
skins = [ skins = [
{id: 0, 'color': 0xff53aa, 'texture': None}, {id: 0, 'color': 0xff53aa, 'texture': None},
@ -346,8 +346,8 @@ class Game:
if(self.obstacles[i]["isUp"] != self.ballPos["up"]): if(self.obstacles[i]["isUp"] != self.ballPos["up"]):
continue continue
if(self.twoPointsDistance((self.obstacles[i]["pos"]["x"], self.obstacles[i]["pos"]["z"]), ballPos) < Game.jumperRadius): if(self.twoPointsDistance((self.obstacles[i]["pos"]["x"], self.obstacles[i]["pos"]["z"]), ballPos) < Game.jumperRadius):
self.p1.sync_send({"type":"game", "content":{"action":8,"id":i}}) self.p1.sync_send({"type":"game", "content":{"action":8,"name":Game.jumpersPos[i]["name"]}})
self.p2.sync_send({"type":"game", "content":{"action":8,"id":i}}) self.p2.sync_send({"type":"game", "content":{"action":8,"name":Game.jumpersPos[i]["name"]}})
self.ballPos["up"] = not self.ballPos["up"] self.ballPos["up"] = not self.ballPos["up"]
def checkWallsColision(self, ballPos): def checkWallsColision(self, ballPos):

View File

@ -6,7 +6,7 @@
# By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ # # By: tomoron <tomoron@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2024/09/09 16:10:26 by tomoron #+# #+# # # Created: 2024/09/09 16:10:26 by tomoron #+# #+# #
# Updated: 2024/09/25 13:20:50 by tomoron ### ########.fr # # Updated: 2024/09/27 17:49:42 by tomoron ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@ -46,7 +46,7 @@ from .gameActions.move import move
# - type # - type
# #
# 8 : jumper colision: # 8 : jumper colision:
# id : index of the jumper # name : name of the jumper
#client actions (actions sent by the client) : #client actions (actions sent by the client) :
# 0 : start : starts a game # 0 : start : starts a game