Skip to content

Commit

Permalink
Change to other player when dice is 1 and reset the roundScore to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
kenvilar committed Dec 3, 2017
1 parent d297ef7 commit 7d433c1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,18 @@ document.querySelector('.btn-roll-dice').addEventListener('click', function () {
document.querySelector('#current-' + activePlayer).textContent = roundScore;
} else {
//Next player
document.querySelector('#current-' + activePlayer).textContent = '0';
document.getElementById('current-1').textContent = '0';
document.getElementById('current-2').textContent = '0';

roundScore = 0;

activePlayer === 1 ? activePlayer = 2 : activePlayer = 1;

document.querySelector('.player-1-panel').classList.toggle('active');
document.querySelector('.player-2-panel').classList.toggle('active');

document.querySelector('#dice-1').style.display = 'none';
document.querySelector('#dice-2').style.display = 'none';
}
});

Expand Down

0 comments on commit 7d433c1

Please sign in to comment.