Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dice Game HTML,CSS & JS in the file Program's Contributed .../JavaScript and added my name to the Contributors #1090

Merged
merged 1 commit into from
Oct 21, 2021
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
1 change: 1 addition & 0 deletions Contributors.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@
<a class="box-item" href="https://github.com/anmolg84"><span>Anmol Gupta</span></a>
<a class="box-item" href="https://github.com/gulshanjakhon"><span>Gulshan Jakhon</span></a>
<a class="box-item" href="https://github.com/code08-ind"><span>Aryan Garg</span></a>
<a class="box-item" href="https://github.com/mariabarkouzou"><span>Maria Barkouzou</span></a>



Expand Down
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="description" content="Dice challenge made with HTML ,CSS and Javascript"/>
<title>Dice</title>
<link rel="icon" href="images/icon.png" />
<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>

<script src ="index.js"></script>

</body>

<footer>
🎲 Maria Barkouzou 🎲
</footer>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//Image 1 setting

let randomNumber1 = Math.floor(Math.random() * 6) + 1;
let randomImage = "dice" + randomNumber1 + ".png";
let randomImageSource = "images/" + randomImage;
let image1 = document.querySelectorAll("img")[0];
image1.setAttribute("src", randomImageSource);

//Image 2 setting

let randomNumber2 = Math.floor(Math.random() * 6) + 1;
let randomImage2 = "dice" + randomNumber2 + ".png";
let randomImageSource2 = "images/" + randomImage2;
let image2 = document.querySelectorAll("img")[1];
image2.setAttribute("src", randomImageSource2);

//Which of the players win

if (randomNumber1 > randomNumber2) {
document.querySelector("h1").innerHTML = "🚩Player 1 wins!";
} else if (randomNumber1 < randomNumber2) {
document.querySelector("h1").innerHTML = "🚩Player 2 wins!";
} else {
document.querySelector("h1").innerHTML = "🎲It's a tie!";
}
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;

}