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 BubbleGame/AnuragC07/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!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>Bubble Game</title>
</head>
<body>
<!-- completed project -->
<div class="outer-box">
<div class="panel-top" id="ptop">
<div class="score">
<h2>hit</h2>
<p id="hitNum">5</p>
</div>
<div class="score">
<h2>timer</h2>
<p id="timerInterval">60</p>
</div>
<div class="score">
<h2>score</h2>
<p id="scoreVal">0</p>
</div>
</div>
<div class="panel-bottom" id="pbtm">
<div class="bubble">
5
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions BubbleGame/AnuragC07/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

58 changes: 58 additions & 0 deletions BubbleGame/AnuragC07/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
var timer = 60;
var score = 0;
var hitrn;


function increaseScore() {
score += 10;
document.querySelector("#scoreVal").textContent = score;
}

function getNewHit() {
hitrn = Math.floor(Math.random() * 10);
document.querySelector("#hitNum").textContent = hitrn;
}



function makeBubble() {
var clutter = "";
for (var i = 1; i <= 180; i++) {
var rn = Math.floor(Math.random() * 10)
clutter += `<div class="bubble">${rn}</div>`;
}
document.querySelector("#pbtm").innerHTML = clutter;
}



function runTimer() {
var timerInt = setInterval(function () {
if (timer > 0) {
timer--;
document.querySelector("#timerInterval").textContent = timer;
}
else {
clearInterval(timerInt);
document.querySelector("#pbtm").innerHTML = `<h1>Game Over <br>
Your Score is = ${score}</h1>`;
document.querySelector("#hitNum").textContent = 0;
document.querySelector("#scoreVal").textContent = 0;
}
}, 1000);
}


document.querySelector("#pbtm")
.addEventListener("click", function(dets){
var clickednum = Number(dets.target.textContent);
if(clickednum == hitrn) {
increaseScore();
makeBubble();
getNewHit();
}
});

runTimer();
makeBubble();
getNewHit();
69 changes: 69 additions & 0 deletions BubbleGame/AnuragC07/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
*{
margin: 0;
padding: 0;
box-sizing: border-box;
overflow: hidden;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}
body {
background:rgb(181, 181, 255);
}
.outer-box {
border: 0px solid red;
border-radius: 12px;
height: 90vh;
width: 80%;
margin: auto;
margin-top: 30px;
}
.panel-top {
display: flex;
flex-direction: row;
padding: 20px 30%;
justify-content: space-around;
border: 0px solid red;
background: rgb(33, 33, 88);
color: white;
}
.score {
display: flex;
flex-direction: row;
gap: 10px;
}
.score h2 {
font-size: 25px;
}
.score p{
font-size: 25px;
border: 2px solid white;
border-radius: 5px;
background: white;
color: rgb(33, 33, 88);
font-weight: 400;
width: 50px;
display: flex;
justify-content: center;
}
.panel-bottom {
background:rgb(255, 255, 255);
height: 90%;
}


.bubble {
display: inline-block;
padding-left: 18px;
padding-top: 10px;
font-size: 25px;
background: rgb(26, 26, 98);
margin: 8px;
color: white;
border-radius: 50%;
height: 50px;
width: 50px;
}
.bubble:hover {
background: rgb(11, 11, 60);
color: rgb(117, 117, 235);
cursor: pointer;
}