diff --git a/Dicee Game/dicee.html b/Dicee Game/dicee.html new file mode 100644 index 0000000..9a5bbf4 --- /dev/null +++ b/Dicee Game/dicee.html @@ -0,0 +1,33 @@ + + + + + Dicee + + + + + + +
+

Refresh Me

+ +
+

Player 1

+ +
+ +
+

Player 2

+ +
+ +
+ + + + + + diff --git a/Dicee Game/images/dice1.png b/Dicee Game/images/dice1.png new file mode 100644 index 0000000..543a9ee Binary files /dev/null and b/Dicee Game/images/dice1.png differ diff --git a/Dicee Game/images/dice2.png b/Dicee Game/images/dice2.png new file mode 100644 index 0000000..472bbac Binary files /dev/null and b/Dicee Game/images/dice2.png differ diff --git a/Dicee Game/images/dice3.png b/Dicee Game/images/dice3.png new file mode 100644 index 0000000..5bb30aa Binary files /dev/null and b/Dicee Game/images/dice3.png differ diff --git a/Dicee Game/images/dice4.png b/Dicee Game/images/dice4.png new file mode 100644 index 0000000..2c116a9 Binary files /dev/null and b/Dicee Game/images/dice4.png differ diff --git a/Dicee Game/images/dice5.png b/Dicee Game/images/dice5.png new file mode 100644 index 0000000..d566cd8 Binary files /dev/null and b/Dicee Game/images/dice5.png differ diff --git a/Dicee Game/images/dice6.png b/Dicee Game/images/dice6.png new file mode 100644 index 0000000..8b98b3c Binary files /dev/null and b/Dicee Game/images/dice6.png differ diff --git a/Dicee Game/images/index.js b/Dicee Game/images/index.js new file mode 100644 index 0000000..e69de29 diff --git a/Dicee Game/index.js b/Dicee Game/index.js new file mode 100644 index 0000000..a30004a --- /dev/null +++ b/Dicee Game/index.js @@ -0,0 +1,23 @@ +var randomNumber1 = Math.floor(Math.random() * 6)+1; //generates a random randomNumber1 + +var randomDiceImage = "dice"+ randomNumber1 + ".png"; + +var imageRandom = "images/"+ randomDiceImage; + +var img1 =document.querySelectorAll("img")[0]; +img1.setAttribute("src",imageRandom); + +var randomNumber2 =Math.floor(Math.random()*6)+1; +var randomImageSrc = "images/dice"+ randomNumber2 +".png"; +document.querySelectorAll("img")[1].setAttribute("src",randomImageSrc); + + +if(randomNumber1>randomNumber2){ + document.querySelector("h1").innerHTML="Player 1 wins"; +} + else if (randomNumber2>randomNumber1) { + document.querySelector("h1").innerHTML="Player 2 wins"; + } + else{ + document.querySelector("h1").innerHTML="draw"; + } diff --git a/Dicee Game/styles.css b/Dicee Game/styles.css new file mode 100644 index 0000000..c5ad740 --- /dev/null +++ b/Dicee Game/styles.css @@ -0,0 +1,41 @@ +.container { + width: 70%; + margin: auto; + text-align: center; +} + +.dice { + text-align: center; + display: inline-block; + +} + +body { + background-color: #393E46; +} + +h1 { + margin: 30px; + font-family: 'Lobster', cursive; + text-shadow: 5px 0 #232931; + font-size: 8rem; + color: #4ECCA3; +} + +p { + font-size: 2rem; + color: #4ECCA3; + font-family: 'Indie Flower', cursive; +} + +img { + width: 80%; +} + +footer { + margin-top: 5%; + color: #EEEEEE; + text-align: center; + font-family: 'Indie Flower', cursive; + +}