pong: fix: oline
This commit is contained in:
parent
69b963a65e
commit
05131dd4b2
@ -130,7 +130,7 @@ def get_impact_point(segment: Segment, ball_segment: Segment) -> Point | None:
|
|||||||
def get_first_impact(segments: list[Segment], ball: Ball):
|
def get_first_impact(segments: list[Segment], ball: Ball):
|
||||||
|
|
||||||
cos: float = round(math.cos(ball.angle), 6)
|
cos: float = round(math.cos(ball.angle), 6)
|
||||||
sin: float = round(math.sin(ball.angle))
|
sin: float = round(math.sin(ball.angle), 6)
|
||||||
|
|
||||||
inc_x: float = (-1) * get_sign(cos) * (config.STROKE_THICKNESS + config.BALL_SIZE / 2)
|
inc_x: float = (-1) * get_sign(cos) * (config.STROKE_THICKNESS + config.BALL_SIZE / 2)
|
||||||
inc_y: float = get_sign(sin) * (config.STROKE_THICKNESS + config.BALL_SIZE / 2)
|
inc_y: float = get_sign(sin) * (config.STROKE_THICKNESS + config.BALL_SIZE / 2)
|
||||||
@ -276,7 +276,7 @@ async def update_ball(game: PongGame, impact_data: dict):
|
|||||||
else:
|
else:
|
||||||
game.ball.speed += config.BALL_SPEED_INC
|
game.ball.speed += config.BALL_SPEED_INC
|
||||||
game.ball.position.location = impact_data.get("impact")
|
game.ball.position.location = impact_data.get("impact")
|
||||||
game.ball.position.time = time.time() * 1000
|
#game.ball.position.time = time.time() * 1000
|
||||||
game.ball.angle = ret
|
game.ball.angle = ret
|
||||||
|
|
||||||
await SyncToAsync(game.broadcast)("update_ball", game.ball.to_dict())
|
await SyncToAsync(game.broadcast)("update_ball", game.ball.to_dict())
|
||||||
|
Loading…
Reference in New Issue
Block a user