Skip to content
Open
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
50 changes: 50 additions & 0 deletions 4) BEATBOX using JS/JavscriptNewGame(Bubble-Game)/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css"/>


</head>
<body>
<div class="main">
<div class="content">
<div class="ptop">
<div class="box">
<h2>Hit</h2>
<div id= "hitter" class="box2">
5
</div>
</div>
<div class="box">
<h2>Timer</h2>
<div id="timerval" class="box2">
60
</div>
</div>
<div class="box">
<h2>Score</h2>
<div id="scoreval" class="box2">
0
</div>
</div>
</div>
<div id="pbtm" class="pbotm">

<div class="bub"><p>5</p></div>

</div>
</div>
</div>

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





</script>
</html>
49 changes: 49 additions & 0 deletions 4) BEATBOX using JS/JavscriptNewGame(Bubble-Game)/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

function makeBubble(){
let some = "";
for(let i=1; i<161;i++){
some +=` <div class="bub">${Math.floor(Math.random()*10)}</div>`;
document.querySelector(".pbotm").innerHTML=some;
}
}
makeBubble();

var timer=60;
function runTimer(){
var timeint=setInterval(function(){
if(timer>0){
timer--;
document.querySelector("#timerval").textContent=timer;
}
else{
clearInterval(timeint);
document.querySelector("#pbtm").innerHTML=`<h1>Game Over!!<h1> `;
// document.querySelector("#pbtm").innerText=`Your Score is ${score}`;
}

},1000)
}
runTimer();
var rn=0;
function hitval(){
rn = Math.floor(Math.random()*10);
document.querySelector("#hitter").textContent=rn;
}
hitval();
var score=0;
function increaseScore(){
score+=10;
document.querySelector("#scoreval").textContent=score;
}
document.querySelector("#pbtm").addEventListener("click",
function(dets){
var clickedNum =Number(dets.target.textContent);
if(rn===clickedNum){
increaseScore();
}
hitval();
makeBubble();
});



79 changes: 79 additions & 0 deletions 4) BEATBOX using JS/JavscriptNewGame(Bubble-Game)/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
.main{
width:100%;
height:100vh;
background-color: rgb(202, 238, 202);
display:flex;
justify-content: center;
align-items: center;
}
.content{
width:80%;
height:85%;
background-color: #fff;
/* display: flex; */
border-radius: 10px;
overflow:hidden;
}
.ptop{
width:100%;
height:6.1rem;
background-color:rgb(72,104,72);
display: flex;
justify-content: space-evenly;
align-items: center;
color:white;
padding:0px 30%;
}
.box{
display:flex;
gap:1.2rem;
align-items: center;
padding: 0.8rem;

}
.box2{
color:rgb(53, 125, 53);
padding: 0.9rem 1.4rem ;
border-radius: 5px;
background-color: white;
font-weight: 600;
font-size: 1.5rem;
}
.pbotm{
display: flex;
gap:0.9rem;
width:100%;
height:calc(85% - 1.6rem);
padding: 1.2rem 0.5rem;
flex-wrap:wrap;

}
#pbtm {
display: flex;
justify-content: center;
align-items: center;
color:red;

}
.bub{

display: flex;
align-items: center;
justify-content: center;
height:2.2rem;
width:2.2rem;
background-color: rgb(72,104,72);
border-radius: 50%;
color:white;
font-weight: 600;
}
.bub:hover{
cursor: pointer;
background-color: rgb(6, 70, 6);
}