Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 59 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. document.querySelector(".btn-roll").addEventListener("click", function () {
  2.     if (gamePlaying) {
  3.         // 1. Random number
  4.         var dice = Math.floor(Math.random() * 6) + 1;
  5.         // 2. display the result
  6.         var diceDOM = document.querySelector(".dice");
  7.         diceDOM.style.display = "block";
  8.         diceDOM.src = "dice-" + dice + ".png";
  9.         // 3. update the round score IF the rolled number was not a 1
  10.         if (dice !== 1) {
  11.             //Add score
  12.             roundScore += dice;
  13.             document.querySelector("#current-" + activePlayer).textContent = roundScore;
  14.         } else {
  15.             //Next player
  16.             nextPlayer();
  17.         }
  18.     }
  19. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top