game: core: use server game calulation form

This commit is contained in:
2024-01-17 14:23:23 +01:00
parent b2dc43c1d8
commit 2bd0624100
15 changed files with 274 additions and 110 deletions

View File

@ -2,13 +2,13 @@
class Ball
{
constructor(game)
constructor(game, position_x, position_y, velocity_x, velocity_y)
{
this.game = game;
this.position_x = game.config.size_x / 2;
this.position_y = game.config.size_y / 2;
this.velocity_x = game.config.ball_speed_start;
this.velocity_y = game.config.ball_speed_start;
this.position_x = position_x;
this.position_y = position_y;
this.velocity_x = velocity_x;
this.velocity_y = velocity_y;
}
_collision(old_pos_x, old_pos_y, new_pos_x, new_pos_y)