Merge remote-tracking branch 'origin/player-movement' into player-movement

This commit is contained in:
Thorsten Rausch
2021-06-17 18:59:43 +02:00
2 changed files with 76 additions and 10 deletions

View File

@@ -138,6 +138,10 @@ io.on('connection', socket => {
if (gameState[socket.room] !== undefined && addedUser) {
if (answerIsCorrect) gameState[socket.room].players[gameState[socket.room].whosNext].move(difficulty);
io.in(socket.room).emit('card destroyed');
io.in(socket.room).emit('player moved', {
"player": gameState[socket.room].whosNext,
"position": gameState[socket.room].players[gameState[socket.room].whosNext].position
});
gameState[socket.room].finish_turn();
}
});
@@ -191,4 +195,4 @@ function shuffleAnswers(card) {
function pad(width, string, padding) {
if (string === undefined || string === null) return pad(width, " ", " ");
return (width <= string.length) ? string : pad(width, string + padding, padding);
}
}