clean: respect es11
This commit is contained in:
@ -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 };
|
@ -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 };
|
||||
|
@ -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 };
|
@ -115,8 +115,8 @@ class Player
|
||||
*/
|
||||
this.rail = this.rail.from_json(data.rail);
|
||||
|
||||
return this
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
export { Player }
|
||||
export { Player };
|
@ -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 };
|
@ -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 };
|
@ -39,4 +39,4 @@ class Time
|
||||
}
|
||||
}
|
||||
|
||||
export { Time }
|
||||
export { Time };
|
@ -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 };
|
Reference in New Issue
Block a user