game: core: change player to player.isconnected
befort: if a player is disconnected he doesn't have an object after: he have un object with a socket == None
This commit is contained in:
@ -1,8 +1,9 @@
|
||||
|
||||
class Player
|
||||
{
|
||||
constructor(id, game, rail_start_x, rail_start_y, rail_stop_x, rail_stop_y, nb_goal, positon)
|
||||
constructor(id, game, rail_start_x, rail_start_y, rail_stop_x, rail_stop_y, nb_goal, positon, is_connected)
|
||||
{
|
||||
this.is_connected = is_connected;
|
||||
this.id = id;
|
||||
this.positon = positon;
|
||||
this.nb_goal = nb_goal;
|
||||
@ -27,7 +28,13 @@ class Player
|
||||
}
|
||||
|
||||
draw(ctx)
|
||||
{
|
||||
{
|
||||
if (this.is_connected === false)
|
||||
{
|
||||
ctx.moveTo(this.rail_start_x, this.rail_start_y);
|
||||
ctx.lineTo(this.rail_stop_x, this.rail_stop_y);
|
||||
return;
|
||||
}
|
||||
let paddle_pos_x = this.rail_start_x + this.diff_x * this.positon,
|
||||
paddle_pos_y = this.rail_start_y + this.diff_y * this.positon;
|
||||
|
||||
|
Reference in New Issue
Block a user