Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions dicegame/dice.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!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/dice1.png">
</div>

<div class="dice">
<p>Player 2</p>
<img class="img2" src="images/dice6.png">
</div>

</div>


<script src="index2.js"></script>
</body>

<footer>
🎲 Thanks to Aryan 🎲
</footer>
</html>
Binary file added dicegame/images/dice1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dicegame/images/dice2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dicegame/images/dice3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dicegame/images/dice4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dicegame/images/dice5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dicegame/images/dice6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added dicegame/images/m2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions dicegame/index2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

var rn1 = Math.floor(Math.random()*6) + 1;
var randomdice = "dice" + rn1 + ".png";

var randomimage = "images/" + randomdice;

var image1 = document.querySelectorAll("img")[0];
image1.setAttribute("src",randomimage);


var rn2 = Math.floor(Math.random()*6) + 1;
var randomdice2 = "dice" + rn2 + ".png";

var randomimage2 = "images/" + randomdice2;

var image2 = document.querySelectorAll("img")[1];
image2.setAttribute("src",randomimage2);

if(rn1>rn2){
document.querySelector("h1").innerHTML = "player 1 wins"
}
else if(rn2>rn1){
document.querySelector("h1").innerHTML = "player 2 wins"
}
else{
document.querySelector("h1").innerHTML = "DRAW"
}
41 changes: 41 additions & 0 deletions dicegame/styles.css
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;

}