game: fix: sync client and server
This commit is contained in:
parent
7f78871240
commit
86572965e3
@ -46,7 +46,7 @@ class Ball
|
|||||||
*/
|
*/
|
||||||
draw(ctx)
|
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)
|
let distance = this.speed * (this.game.time.deltaTime() / 1000)
|
||||||
|
|
||||||
this.position.x = this.position.x + distance * Math.cos(this.angle);
|
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);
|
this.draw(ctx);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user