game: fix: sync client and server

This commit is contained in:
starnakin 2024-02-02 16:38:01 +01:00 committed by AdrienLSH
parent 4ba4d393a5
commit c7e7410baf

View File

@ -46,7 +46,7 @@ class Ball
*/
draw(ctx)
{
ctx.rect(this.position.x - this.size / 2, this.position.y - this.size / 2, this.game.config.ball_size, this.game.config.ball_size);
ctx.rect(this.position.x - this.size / 2, this.position.y - this.size / 2, this.size, this.size);
}
/**
@ -58,7 +58,7 @@ class Ball
let distance = this.speed * (this.game.time.deltaTime() / 1000)
this.position.x = this.position.x + distance * Math.cos(this.angle);
this.position.y = this.position.y + distance * Math.sin(this.angle);
this.position.y = this.position.y - distance * Math.sin(this.angle);
this.draw(ctx);
}