game: multiplayer: work
This commit is contained in:
@ -10,18 +10,14 @@ import math
|
||||
class Ball:
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.size: float
|
||||
self.position: Position
|
||||
self.angle: float
|
||||
self.speed: float
|
||||
|
||||
self.reset()
|
||||
self.speed = 0
|
||||
self.size: float = config.BALL_SIZE
|
||||
self.position: Position = Position(Point(config.BALL_SPAWN_POS_X + self.size / 2, config.BALL_SPAWN_POS_Y + self.size / 2), time.time())
|
||||
self.angle: float = 0
|
||||
self.speed: float = 0
|
||||
|
||||
def reset(self) -> None:
|
||||
self.size = config.BALL_SIZE
|
||||
self.position = Position(Point(config.BALL_SPAWN_POS_X + self.size / 2, config.BALL_SPAWN_POS_Y + self.size / 2), time.time())
|
||||
self.angle = math.pi * 0
|
||||
def reset(self, target: Point) -> None:
|
||||
self.position: Position = Position(Point(config.BALL_SPAWN_POS_X + self.size / 2, config.BALL_SPAWN_POS_Y + self.size / 2), time.time())
|
||||
self.angle = math.atan2(target.y - self.position.location.y, target.x - self.position.location.x)
|
||||
self.speed = config.BALL_SPEED_START
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
|
Reference in New Issue
Block a user