Merge pull request #28 from H4CK3R-01/multiplayer

Fixed multiplayer
This commit is contained in:
H4CK3R-01 2021-06-14 12:30:33 +02:00 committed by GitHub
commit aa6d67fd33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -124,6 +124,8 @@ io.on('connection', socket => {
socket.on('card finished', function (difficulty) { socket.on('card finished', function (difficulty) {
gameState['positions'][gameState['players'].indexOf(socket.username)] += difficulty; gameState['positions'][gameState['players'].indexOf(socket.username)] += difficulty;
gameState['whosNext'] += 1;
if(gameState['whosNext'] === gameState['players'].length) gameState['whosNext'] = 0;
io.in(socket.room).emit('card destroyed'); io.in(socket.room).emit('card destroyed');
}); });
}); });

View File

@ -169,6 +169,8 @@ function start_game() {
}); });
socket.on('card destroyed', function () { socket.on('card destroyed', function () {
diced = false;
show_card = false;
card.destroyCard(); card.destroyCard();
rolled_number_text.destroy(); rolled_number_text.destroy();
border_card_stack.clear(); border_card_stack.clear();