Making sure that even is a user did not move, the reconnection can happen without issues and resume at the old position

This commit is contained in:
David Négrier 2020-06-11 10:00:30 +02:00
parent ce7b4092a6
commit 77167c28a6

View File

@ -232,6 +232,8 @@ export class Connection implements ConnectionInterface {
} }
joinARoom(roomId: string, startX: number, startY: number, direction: string, moving: boolean): void { joinARoom(roomId: string, startX: number, startY: number, direction: string, moving: boolean): void {
let point = new Point(startX, startY, direction, moving);
this.lastPositionShared = point;
this.getSocket().emit(EventMessage.JOIN_ROOM, { roomId, position: {x: startX, y: startY, direction, moving }}, (userPositions: MessageUserPositionInterface[]) => { this.getSocket().emit(EventMessage.JOIN_ROOM, { roomId, position: {x: startX, y: startY, direction, moving }}, (userPositions: MessageUserPositionInterface[]) => {
this.GameManager.initUsersPosition(userPositions); this.GameManager.initUsersPosition(userPositions);
}); });