-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0ff2bd0
Showing
9 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" dir="ltr"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Dicee</title> | ||
<link rel="stylesheet" href="styles.css" /> | ||
<link | ||
href="https://fonts.googleapis.com/css?family=Indie+Flower|Lobster" | ||
rel="stylesheet" | ||
/> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Refresh Me</h1> | ||
|
||
<div class="dice"> | ||
<p>Player 1</p> | ||
<img class="img1" src="images/dice6.png" /> | ||
</div> | ||
|
||
<div class="dice"> | ||
<p>Player 2</p> | ||
<img class="img2" src="images/dice6.png" /> | ||
</div> | ||
</div> | ||
|
||
<footer>🎲The Dice Game🎲</footer> | ||
</body> | ||
<script src="index.js" charset="utf-8"></script> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
//set both dices to 6 | ||
document.querySelector(".img1").setAttribute("src","./images/dice6.png"); | ||
document.querySelector(".img2").setAttribute("src","./images/dice6.png"); | ||
|
||
//set random numbers | ||
var randomNumber1 = Math.floor(Math.random() * 6) + 1; | ||
var randomNumber2 = Math.floor(Math.random() * 6) + 1; | ||
|
||
//set dice name | ||
var dice1= "dice"+randomNumber1+".png"; | ||
var dice2= "dice"+randomNumber2+".png"; | ||
|
||
//place this image inside the <img> element | ||
document.querySelector(".img1").setAttribute("src","./images/"+dice1); | ||
document.querySelectorAll("img")[1].setAttribute("src","./images/"+dice2); | ||
|
||
|
||
|
||
//set conditions | ||
if(randomNumber1>randomNumber2) | ||
{ | ||
document.querySelector("h1").innerHTML="Player 1 Wins!"; | ||
}; | ||
|
||
if(randomNumber1<randomNumber2) | ||
{ | ||
document.querySelector("h1").innerHTML="Player 2 Wins!"; | ||
}; | ||
if(randomNumber1===randomNumber2) | ||
{ | ||
document.querySelector("h1").innerHTML="Draw!"; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
|
||
} |