Skip to content

Commit c90445b

Browse files
authored
Add files via upload
1 parent c536187 commit c90445b

File tree

9 files changed

+91
-0
lines changed

9 files changed

+91
-0
lines changed

Dice Challenge/dicee.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="en" dir="ltr">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Dicee</title>
6+
<link rel="stylesheet" href="styles.css">
7+
<link href="https://fonts.googleapis.com/css?family=Indie+Flower|Lobster" rel="stylesheet">
8+
9+
</head>
10+
<body>
11+
12+
<div class="container">
13+
<h1>Refresh Me</h1>
14+
15+
<div class="dice">
16+
<p>Player 1</p>
17+
<img class="img1" src="">
18+
</div>
19+
20+
<div class="dice">
21+
<p>Player 2</p>
22+
<img class="img2" src="">
23+
</div>
24+
25+
</div>
26+
27+
28+
</body>
29+
30+
<footer>
31+
www 🎲 App Brewery 🎲 com
32+
</footer>
33+
</html>

Dice Challenge/images/dice1.png

2.5 KB
Loading

Dice Challenge/images/dice2.png

2.16 KB
Loading

Dice Challenge/images/dice3.png

2.38 KB
Loading

Dice Challenge/images/dice4.png

2.55 KB
Loading

Dice Challenge/images/dice5.png

2.76 KB
Loading

Dice Challenge/images/dice6.png

2.91 KB
Loading

Dice Challenge/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
var dicearray = ["./images/dice1.png","./images/dice2.png","./images/dice3.png","./images/dice4.png","./images/dice5.png","./images/dice6.png"];
2+
3+
var player1 = Math.floor(Math.random() * 6)+1;
4+
document.querySelectorAll("img")[0].setAttribute("src", "./images/dice"+player1+".png");
5+
6+
var player2 = Math.floor(Math.random() * 6);
7+
document.querySelectorAll("img")[1].setAttribute("src", dicearray[player2]);
8+
9+
// winner
10+
11+
if (player1>player2){
12+
document.querySelector("h1").innerHTML = "Player 1 wins!";
13+
} else if (player2>player1){
14+
document.querySelector("h1").innerHTML = "Player 2 wins!";
15+
} else{
16+
document.querySelector("h1").innerHTML = "It's a Draw!\nRefresh to roll again";
17+
}

Dice Challenge/styles.css

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
.container {
2+
width: 70%;
3+
margin: auto;
4+
text-align: center;
5+
}
6+
7+
.dice {
8+
text-align: center;
9+
display: inline-block;
10+
11+
}
12+
13+
body {
14+
background-color: #393E46;
15+
}
16+
17+
h1 {
18+
margin: 30px;
19+
font-family: 'Lobster', cursive;
20+
text-shadow: 5px 0 #232931;
21+
font-size: 8rem;
22+
color: #4ECCA3;
23+
}
24+
25+
p {
26+
font-size: 2rem;
27+
color: #4ECCA3;
28+
font-family: 'Indie Flower', cursive;
29+
}
30+
31+
img {
32+
width: 80%;
33+
}
34+
35+
footer {
36+
margin-top: 5%;
37+
color: #EEEEEE;
38+
text-align: center;
39+
font-family: 'Indie Flower', cursive;
40+
41+
}

0 commit comments

Comments
 (0)