game: online: recoded but collision not work
This commit is contained in:
@ -17,8 +17,9 @@ export class PongPlayer extends APlayer
|
||||
* @param {String} username
|
||||
* @param {String} avatar
|
||||
* @param {Client} client
|
||||
* @param {Boolean} isEliminated
|
||||
*/
|
||||
constructor(client, game, id, username, avatar, score = [], rail = new Segment(game), position = new Position(0.5), isConnected)
|
||||
constructor(client, game, id, username, avatar, score = [], rail = new Segment(game), position = new Position(0.5), isConnected, isEliminated)
|
||||
{
|
||||
super(client, game, id, username, avatar, isConnected)
|
||||
|
||||
@ -41,6 +42,11 @@ export class PongPlayer extends APlayer
|
||||
* @type {PongPlayer}
|
||||
*/
|
||||
this.game = game;
|
||||
|
||||
/**
|
||||
* @type {Boolean}
|
||||
*/
|
||||
this.isEliminated = isEliminated;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,13 +63,10 @@ export class PongPlayer extends APlayer
|
||||
*/
|
||||
draw(ctx)
|
||||
{
|
||||
if (this.isConnected === false)
|
||||
if (this.isConnected === false || this.isEliminated === true)
|
||||
{
|
||||
if(ctx instanceof CanvasRenderingContext2D)
|
||||
{
|
||||
ctx.moveTo(this.rail.start.x, this.rail.start.y);
|
||||
ctx.lineTo(this.rail.stop.x, this.rail.stop.y);
|
||||
}
|
||||
ctx.moveTo(this.rail.start.x, this.rail.start.y);
|
||||
ctx.lineTo(this.rail.stop.x, this.rail.stop.y);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user