diff --git a/DiceGame/DICE.svg b/DiceGame/DICE.svg new file mode 100644 index 00000000..57ae9101 --- /dev/null +++ b/DiceGame/DICE.svg @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + dice + 2009-06-18T16:09:18 + A draw of a dice + https://openclipart.org/detail/26713/dice-by-badaman + + + badaman + + + + + azar + dado + dice + inkscape + line art + lucky + random + suerte + vectorial + + + + + + + + + + + diff --git a/DiceGame/LICENSE b/DiceGame/LICENSE new file mode 100644 index 00000000..d9cd0d2e --- /dev/null +++ b/DiceGame/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Stavros Karathanasis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/DiceGame/README.md b/DiceGame/README.md new file mode 100644 index 00000000..d56ca54e --- /dev/null +++ b/DiceGame/README.md @@ -0,0 +1,4 @@ +# DiceGame + +@ https://stav-kr.github.io/DiceGame/ +dice images from...https://www.freeiconspng.com/img/27671 diff --git a/DiceGame/dice1.png b/DiceGame/dice1.png new file mode 100644 index 00000000..5e524bef Binary files /dev/null and b/DiceGame/dice1.png differ diff --git a/DiceGame/dice2.png b/DiceGame/dice2.png new file mode 100644 index 00000000..c7e83f0f Binary files /dev/null and b/DiceGame/dice2.png differ diff --git a/DiceGame/dice3.png b/DiceGame/dice3.png new file mode 100644 index 00000000..bd9874ff Binary files /dev/null and b/DiceGame/dice3.png differ diff --git a/DiceGame/dice4.png b/DiceGame/dice4.png new file mode 100644 index 00000000..438943c2 Binary files /dev/null and b/DiceGame/dice4.png differ diff --git a/DiceGame/dice5.png b/DiceGame/dice5.png new file mode 100644 index 00000000..6966980c Binary files /dev/null and b/DiceGame/dice5.png differ diff --git a/DiceGame/dice6.png b/DiceGame/dice6.png new file mode 100644 index 00000000..c2e8e16f Binary files /dev/null and b/DiceGame/dice6.png differ diff --git a/DiceGame/index.html b/DiceGame/index.html new file mode 100644 index 00000000..4de081d1 --- /dev/null +++ b/DiceGame/index.html @@ -0,0 +1,42 @@ + + + + + + + + + Dice roll game + + + + +
+ +

Dice Roll Game

+
+ Can you beat Morgan, the legendary dice roller champion of the world? +
+
+

You

+ +
+ +
+

Morgan

+ +
+
+ + +
+

+

+
+ + + + + \ No newline at end of file diff --git a/DiceGame/peek.svg b/DiceGame/peek.svg new file mode 100644 index 00000000..7c87cc81 --- /dev/null +++ b/DiceGame/peek.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DiceGame/script.js b/DiceGame/script.js new file mode 100644 index 00000000..e1e380f9 --- /dev/null +++ b/DiceGame/script.js @@ -0,0 +1,37 @@ +'use strict'; +const rollBtn = document.querySelector('.btnClick'); +rollBtn.addEventListener('click', DiceRoll); + +let score = 0; + +function DiceRoll(roll1, roll2) { + + var roll1 = Math.trunc(Math.random() * 6) + 1 + var roll2 = Math.trunc(Math.random() * 6) + 1 + + document.querySelector(".dice_img_1").setAttribute("src", + "dice" + roll1 + ".png"); + + document.querySelector(".dice_img_2").setAttribute("src", + "dice" + roll2 + ".png"); + + if (roll1 === roll2) { + document.querySelector("h3").innerHTML = "Draw!"; + + } else if (roll1 < roll2) { + document.querySelector("h3").innerHTML = (" Morgan wins!"); + + } else { + document.querySelector("h3").innerHTML = (" You win!"); + score++; + document.querySelector("h4").innerHTML = "points: " + score; + + + + } + + + + + +} \ No newline at end of file diff --git a/DiceGame/style.css b/DiceGame/style.css new file mode 100644 index 00000000..6cab57b7 --- /dev/null +++ b/DiceGame/style.css @@ -0,0 +1,88 @@ + + +body{ + background-color: black; + /*background: + linear-gradient(to right, #eb753f 0%, #6fa5ec 100%);*/ + text-align: center; +} + +/* +.container{ + + padding-top: 0.5%;* +e42a9d +} +*/ + +.dice-section{ + + margin: 0px 50px; + display: inline-block; +} + + +p{ + font-size: xx-large; + font-family: 'Courier New', Courier, monospace; + font-weight: bold; + color: white; +} + +img{ + + width: 150px; + height: 150px; +} + +h5,h1,h3, h4{ + font-family: 'Courier New', Courier, monospace; + color: white; +} + +.playBtn{ + margin: 10px; + background-color: transparent; + background:none; + +} + +button { + + background-color: #ffc247; + border-radius: 10px; + + color: black; + text-align: center; + font-size: 28px; + padding: 10px; + width: 190px; + cursor: pointer; + margin: 5px; + +} + +button:hover{ + color: rgb(142, 52, 245); +} + +.rotate { + animation: rotation 6s; +} + +.linear { + animation-timing-function: linear; +} + +.infinite { + animation-iteration-count: infinite; +} + +@keyframes rotation { + from { + transform: rotate(0deg); + } + to { + transform: rotate(359deg); + } +}