fixed next drawer
This commit is contained in:
@@ -24,8 +24,6 @@ services:
|
||||
build: ./srcs/backend
|
||||
expose:
|
||||
- "3001"
|
||||
# ports:
|
||||
# - "3001:3001"
|
||||
depends_on:
|
||||
- database
|
||||
volumes:
|
||||
|
||||
@@ -194,7 +194,8 @@ export class GameRoomWindow extends Window {
|
||||
players: [],
|
||||
currentPlayerIndex: 0,
|
||||
guessedLetters: [],
|
||||
scores: {}
|
||||
scores: {},
|
||||
counter: 0
|
||||
};
|
||||
|
||||
this.initDrawing();
|
||||
@@ -1568,8 +1569,11 @@ export class GameRoomWindow extends Window {
|
||||
|
||||
nextRound() {
|
||||
// Move to next player
|
||||
this.gameState.currentPlayerIndex = (this.gameState.currentPlayerIndex + 1) % this.gameState.players.length;
|
||||
const nextDrawer = this.gameState.players[this.gameState.currentPlayerIndex];
|
||||
this.gameState.counter++;
|
||||
if (this.gameState.counter >= this.gameState.players.length) {
|
||||
this.gameState.counter = 0;
|
||||
}
|
||||
const nextDrawer = this.gameState.players[this.gameState.counter];
|
||||
|
||||
if (this.socket?.connected) {
|
||||
this.socket.emit('game-next-round', { drawer: nextDrawer });
|
||||
|
||||
Reference in New Issue
Block a user