collision algo with Hugo
+ ball.dir added to EventGameUpdate
This commit is contained in:
@@ -81,12 +81,20 @@ function inGameListener(event: MessageEvent)
|
||||
function gameUpdate(data: ev.EventGameUpdate)
|
||||
{
|
||||
console.log("gameUpdate");
|
||||
gc.playerLeft.pos.y = Math.floor(data.playerLeft.y);
|
||||
gc.playerRight.pos.y = Math.floor(data.playerRight.y);
|
||||
gc.ball.pos.x = Math.floor(data.ball.x);
|
||||
gc.ball.pos.y = Math.floor(data.ball.y);
|
||||
gc.ball.speed = Math.floor(data.ball.speed);
|
||||
|
||||
|
||||
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.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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user