collision algo with Hugo

+ ball.dir added to EventGameUpdate
This commit is contained in:
LuckyLaszlo
2022-11-25 14:54:17 +01:00
parent 3474d54a2b
commit 4aafbac1a5
6 changed files with 93 additions and 37 deletions

View File

@@ -97,9 +97,19 @@ class GameSession {
const gc = s.components;
const update: ev.EventGameUpdate = {
type: en.EventTypes.gameUpdate,
playerLeft: {y: gc.playerLeft.pos.y},
playerRight: {y: gc.playerRight.pos.y},
ball: {x: gc.ball.pos.x, y: gc.ball.pos.y, speed: gc.ball.speed},
playerLeft: {
y: gc.playerLeft.pos.y
},
playerRight: {
y: gc.playerRight.pos.y
},
ball:{
x: gc.ball.pos.x,
y: gc.ball.pos.y,
dirX: gc.ball.dir.x,
dirY: gc.ball.dir.y,
speed: gc.ball.speed
},
lastInputId: 0
};
s.playersMap.forEach( (client) => {