Skip to content

Commit

Permalink
Merge pull request #997 from DevanshKyada27/Cat-Game
Browse files Browse the repository at this point in the history
Cat Game/DevanshKyada27
  • Loading branch information
NitkarshChourasia authored May 17, 2024
2 parents 22577c7 + f30e521 commit b48b879
Show file tree
Hide file tree
Showing 3 changed files with 447 additions and 69 deletions.
92 changes: 75 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fortune Teller App</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>Fortune Teller App</h1>
<p class="fortune"></p>
<button id="generate-fortune">Generate my Fortune</button>
</div>
<script src="script.js"></script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Cat Game</title>
</head>
<body>
<div class="container">
<div class="wrapper">
<div class="ears">
<div class="ear"></div>
<div class="ear"></div>
</div>
<div class="head">
<div class="mustaches">
<div class="mus">
<div class="mustach"></div>
<div class="mustach"></div>
<div class="mustach"></div>
</div>
<div class="mus">
<div class="mustach"></div>
<div class="mustach"></div>
<div class="mustach"></div>
</div>
</div>
<div class="eyes">
<div class="eye"></div>
<div class="eye"></div>
</div>
<div class="nose">
<div class="shape"></div>
</div>
<div class="mouth">^</div>
</div>
<div class="body"></div>
<div class="pads">
<div class="pad"></div>
<div class="pad"></div>
</div>
<div class="hat">
<div class="bottom"></div>
</div>
<div class="glasses">
<div class="glass"></div>
<div class="glass"></div>
</div>
<div class="tie"></div>
</div>
<div class="controls">
<input type="checkbox" id="eyeglasses">
<input type="checkbox" id="hat">
<input type="checkbox" id="tie">
<label class="glassescontrol" data-text="eyeglasses" for="eyeglasses">
<div class="glassesicon">
<div class="glassicon"></div>
<div class="glassicon"></div>
</div>
</label>
<label data-text="Hat" class="hatcontrol" for="hat">
<div class="haticon">
<div class="bottom">
</div>
</div>
</label>
<label data-text="Tie" class="tiecontrol" for="tie">
<div class="tieicon"></div>
</label>
</div>
</div>
<script src="./script.js"></script>
</body>
</html>
50 changes: 35 additions & 15 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,35 @@
const fortunes = [
"Your future is looking bright!",
"A new opportunity will come your way soon.",
"You will find happiness in unexpected places.",
"Don't be afraid to take risks.",
"Good things will happen when you least expect them.",
"Believe in yourself, and you will succeed."

];

document.getElementById("generate-fortune").addEventListener("click", () => {
const randomIndex = Math.floor(Math.random() * fortunes.length);
const fortuneText = fortunes[randomIndex];
document.querySelector(".fortune").textContent = fortuneText;
});
//controls
const hatcheck = document.querySelector("#hat");
const glassescheck = document.querySelector("#eyeglasses");
const tiecheck = document.querySelector("#tie");
//accessories
const hat = document.querySelector(".hat");
const glasses = document.querySelector(".glasses");
const tie = document.querySelector(".tie");
//Reveal Hat
hatcheck.addEventListener("change", hatfun);
function hatfun() {
if (hatcheck.checked == true) {
hat.style.bottom = "165px";
} else {
hat.style.bottom = "400px";
}
}
//Reveal Eyeglasses
glassescheck.addEventListener("change", glassesfun);
function glassesfun() {
if (glassescheck.checked == true) {
glasses.style.right = "50%";
} else {
glasses.style.right = "-50%";
}
}
//Reveal Tie
tiecheck.addEventListener("change", tiefun);
function tiefun() {
if (tiecheck.checked == true) {
tie.style.bottom = "10px";
} else {
tie.style.bottom = "-80px";
}
}
Loading

0 comments on commit b48b879

Please sign in to comment.