game: advent to online
This commit is contained in:
8
games/objects/Ball.py
Normal file
8
games/objects/Ball.py
Normal file
@ -0,0 +1,8 @@
|
||||
from .. import config
|
||||
|
||||
class Ball:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.x: float = config.BALL_SPAWN_POS_X
|
||||
self.y: float = config.BALL_SPAWN_POS_Y
|
||||
|
8
games/objects/Game.py
Normal file
8
games/objects/Game.py
Normal file
@ -0,0 +1,8 @@
|
||||
from .Ball import Ball
|
||||
from .Paddle import Paddle
|
||||
|
||||
class Game:
|
||||
|
||||
def __init__(self, paddles: [Paddle], ball: Ball) -> None:
|
||||
self.ball: Ball = ball
|
||||
self.paddles: [paddles] = paddles
|
@ -14,4 +14,5 @@ class GameMember(AbstractRoomMember):
|
||||
return
|
||||
|
||||
def send_ball(self, ball):
|
||||
pass
|
||||
self.send("update_ball_pos", {"x": ball.x,
|
||||
"y": ball.y})
|
8
games/objects/Paddle.py
Normal file
8
games/objects/Paddle.py
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
class Player:
|
||||
|
||||
def __init__(self, user_id, pos, nb_goal) -> None:
|
||||
self.user_id = user_id
|
||||
self.pos = pos
|
||||
self.nb_goal = nb_goal
|
Reference in New Issue
Block a user