messages draw on canvas
+ bugfix: vector.assign() Uncaught TypeError
This commit is contained in:
@@ -84,17 +84,11 @@ function gameUpdate(data: ev.EventGameUpdate)
|
||||
|
||||
gc.playerLeft.pos.y = data.playerLeft.y;
|
||||
gc.playerRight.pos.y = data.playerRight.y;
|
||||
gc.ball.pos.x = data.ball.x;
|
||||
gc.ball.pos.y = data.ball.y;
|
||||
|
||||
gc.ball.pos.assign(data.ball.x, data.ball.y);
|
||||
gc.ball.dir.assign(data.ball.dirX, data.ball.dirY);
|
||||
gc.ball.speed = data.ball.speed;
|
||||
|
||||
gc.ball.dir.x = data.ball.dirX;
|
||||
gc.ball.dir.y = data.ball.dirY;
|
||||
|
||||
// ERROR: Uncaught TypeError: gc.ball.pos.assign is not a function
|
||||
// Why ?
|
||||
// gc.ball.pos.assign( data.ball.x, data.ball.y );
|
||||
|
||||
repeatInput(data.lastInputId); // server reconciliation
|
||||
}
|
||||
|
||||
@@ -113,11 +107,15 @@ function scoreUpdate(data: ev.EventScoreUpdate)
|
||||
|
||||
function matchEnd(data: ev.EventMatchEnd)
|
||||
{
|
||||
console.log("matchEnd");
|
||||
if (data.winner === clientInfo.side) {
|
||||
alert("WIN"); // placeholder TODO draw
|
||||
gc.text1.pos.assign(c.w*0.415, c.h_mid);
|
||||
gc.text1.text = "WIN";
|
||||
}
|
||||
else {
|
||||
alert("LOSE"); // placeholder TODO draw
|
||||
gc.text1.pos.assign(c.w*0.383, c.h_mid);
|
||||
gc.text1.text = "LOSE";
|
||||
}
|
||||
// matchEnded = true;
|
||||
}
|
||||
|
||||
// export let matchEnded = false;
|
||||
|
||||
Reference in New Issue
Block a user