fix players moving when answers are wrong

This commit is contained in:
Thorsten Rausch
2021-06-15 18:38:55 +02:00
parent c243138b87
commit 4674720cfb
2 changed files with 5 additions and 4 deletions

View File

@@ -154,8 +154,8 @@ io.on('connection', socket => {
}
});
socket.on('card finished', function (difficulty) {
gameState['players'][gameState['whosNext']].move(difficulty); //TODO: stop players from moving when answer is wrong
socket.on('card finished', function (difficulty, answerIsCorrect) {
if (answerIsCorrect) gameState['players'][gameState['whosNext']].move(difficulty);
gameState['whosNext'] += 1;
if(gameState['whosNext'] === gameState['players'].length) gameState['whosNext'] = 0;
io.in(socket.room).emit('card destroyed');