clean: respect es11

This commit is contained in:
2024-02-20 09:22:11 +01:00
parent 54ef19a340
commit c143d96443
36 changed files with 163 additions and 163 deletions

View File

@ -55,7 +55,7 @@ class Ball
*/
render(ctx)
{
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.y = this.position.y - distance * Math.sin(this.angle);
@ -70,8 +70,8 @@ class Ball
this.angle = data.angle;
this.speed = data.speed;
return this
return this;
}
}
export { Ball }
export { Ball };

View File

@ -1,6 +1,6 @@
import { sleep } from "../../utils/sleep.js";
import { Ball } from "./Ball.js";
import { GameConfig } from "./GameConfig.js"
import { GameConfig } from "./GameConfig.js";
import { Player } from "./Player.js";
import { Time } from "./Time.js";
import { Wall } from "./Wall.js";
@ -150,7 +150,7 @@ class Game
if (data.detail === "update_paddle")
this._receive_update_paddle(data);
else if (data.detail === "update_ball")
this._receive_ball(data)
this._receive_ball(data);
else if (data.detail === "init_game")
this._init_game(data);
}
@ -160,7 +160,7 @@ class Game
/**
* @type {Ball}
*/
this.ball = (new Ball(this)).from_json(data.ball)
this.ball = (new Ball(this)).from_json(data.ball);
/**
* @type {[Wall]}
@ -174,7 +174,7 @@ class Game
/**
* @type {[Player]}
*/
this.players = []
this.players = [];
const players_data = data.players;
players_data.forEach((player_data) => {
this.players.push(new Player(this).from_json(player_data));
@ -216,4 +216,4 @@ class Game
}
}
export { Game }
export { Game };

View File

@ -1,5 +1,5 @@
import { Player } from "./Player.js";
import { Client } from "../client.js"
import { Client } from "../client.js";
import { Game } from "./Game.js";
import { Segment } from "./Segment.js";
@ -66,4 +66,4 @@ class MyPlayer extends Player
}
}
export { MyPlayer }
export { MyPlayer };

View File

@ -115,8 +115,8 @@ class Player
*/
this.rail = this.rail.from_json(data.rail);
return this
return this;
}
}
export { Player }
export { Player };

View File

@ -20,11 +20,11 @@ class Point
from_json(data)
{
this.x = data.x
this.y = data.y
this.x = data.x;
this.y = data.y;
return this
return this;
}
}
export { Point }
export { Point };

View File

@ -1,4 +1,4 @@
import { Point } from "./Point.js"
import { Point } from "./Point.js";
class Segment
{
@ -54,4 +54,4 @@ class Segment
}
}
export { Segment }
export { Segment };

View File

@ -39,4 +39,4 @@ class Time
}
}
export { Time }
export { Time };

View File

@ -20,10 +20,10 @@ class Wall
from_json(data)
{
this.rail = this.rail.from_json(data.rail)
this.rail = this.rail.from_json(data.rail);
return this
return this;
}
}
export { Wall }
export { Wall };