42_ft_transcendence/games/objects/Ball.py

23 lines
650 B
Python

from .. import config
class Ball:
def __init__(self) -> None:
self.postion_x: float = config.BALL_SPAWN_POS_X
self.postion_y: float = config.BALL_SPAWN_POS_Y
self.velocity_x: float = config.BALL_SPEED_START
self.velocity_y: float = config.BALL_SPEED_START
self.size: float = config.BALL_SIZE
def to_dict(self):
data: dict = {
"size": self.size,
"position_x": self.postion_x,
"position_y": self.postion_y,
"velocity_x": self.velocity_x,
"velocity_y": self.velocity_y,
}
return data