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