fix: game: 2d work

This commit is contained in:
2024-04-10 15:40:54 +00:00
parent 8b9c4d7c1c
commit 0b7e72d8e2
10 changed files with 41 additions and 39 deletions

View File

@ -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))