fix: game: 2d work
This commit is contained in:
@ -253,7 +253,7 @@ async def update_ball(game: PongGame, impact_data: dict) -> None:
|
||||
await asyncio.sleep(0.1) # delay to create frontend animation
|
||||
game.ball.reset()
|
||||
else:
|
||||
game.ball.position = impact_data.get("impact")
|
||||
game.ball.position.location = impact_data.get("impact")
|
||||
|
||||
await SyncToAsync(game.broadcast)("update_ball", game.ball.to_dict())
|
||||
|
||||
@ -288,8 +288,9 @@ async def render(game: PongGame):
|
||||
routine_ball.cancel()
|
||||
routine_players.cancel()
|
||||
return
|
||||
await asyncio.sleep(0.3)
|
||||
await asyncio.sleep(0.05)
|
||||
|
||||
def routine(game: PongGame):
|
||||
|
||||
asyncio.run(render(game))
|
||||
|
||||
|
Reference in New Issue
Block a user