game: online: limit max ball speed
This commit is contained in:
parent
54edc080ab
commit
96c99a6f2d
@ -11,6 +11,7 @@ MAP_CENTER_Y = MAP_SIZE_Y / 2
|
|||||||
|
|
||||||
WALL_RATIO = 1
|
WALL_RATIO = 1
|
||||||
|
|
||||||
|
BALL_SPEED_MAX = 550
|
||||||
BALL_SPEED_INC = 50
|
BALL_SPEED_INC = 50
|
||||||
BALL_SPEED_START = 170
|
BALL_SPEED_START = 170
|
||||||
BALL_SIZE = 4
|
BALL_SIZE = 4
|
||||||
|
@ -274,7 +274,7 @@ async def update_ball(game: PongGame, impact_data: dict):
|
|||||||
await asyncio.sleep(0.1) # create frontend animation
|
await asyncio.sleep(0.1) # create frontend animation
|
||||||
await SyncToAsync(game.goal)(ret)
|
await SyncToAsync(game.goal)(ret)
|
||||||
else:
|
else:
|
||||||
game.ball.speed += config.BALL_SPEED_INC
|
game.ball.speed = min(game.ball.speed + config.BALL_SPEED_INC, config.BALL_SPEED_MAX)
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user