Skip to content

Commit

Permalink
I made changes in the files
Browse files Browse the repository at this point in the history
  • Loading branch information
aletishiva218 committed Aug 5, 2023
0 parents commit 72acb6c
Show file tree
Hide file tree
Showing 6 changed files with 464 additions and 0 deletions.
Binary file added background_audio.mp3
Binary file not shown.
Binary file added bird.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 dead_sound.wav
Binary file not shown.
37 changes: 37 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Flying Game</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Gruppo&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIAHQAmAMBEQACEQEDEQH/xAAbAAACAgMBAAAAAAAAAAAAAAAABQQGAgMHAf/EADwQAAIBAwIDBQYEBAQHAAAAAAECAwAEEQUSBiExE0FRYYEUIjJxkaEHQrHRM1JiwSMm4fAVFiWCorLx/8QAGwEBAAMBAQEBAAAAAAAAAAAAAAMEBQIBBgf/xAAyEQACAQM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t0V2f8O5o2O1WI8qi9jo9jj2al2M7XgZlcZiJPmKkjQpR2idRo047Iazac+ldmspdgy5VW/t9q+X47RjTqR8NYznOO5v2E5Tg+Z5a/ghRSiC1VJpdwU435wTz5Zz+hrMrwjVq81JbrbGzW/066FuMZRj539Tbo+vXMGqRpbsZLb4ZU5YPhjwIr6jhFGvCm51m9dk2/wCzJv503JRgtt2dGikEqB16EZrYKBnQBQBQBQBQBQBQBQBQBQBQBQBQBQBQC3W9LXU7Qx7tkq845P5T+1U7uyp3UcT3WzLFvcSoSytfgc9n0fUXvjDexBNrZwOYfzzUVjw6naap5ff/AESXV5KvpjC7Ft0nhyGNUmAC56jHWtEpllRQihR0FAZUAUAUAUAUAUAUAUAUAUAUAUAUAUAUAUBg8aSY3qDjpmgM6AKAKAKAKAKAKA//2Q==" type="image/x-icon">
</head>
<body>
<div class="gameContainer">
<h1 align="center">Flying Bird Game</h1>
<div class="score">Score: 0</div>

<div class="options"><div class="gameover">Game Over</div><div class="yourscore">Your Score:0</div><div class="replay">Replay</div></div>
<div class="kite kite1"></div>
<div class="upper">
<div class="knife item0"></div>
<div class="knife item1"></div>
<div class="knife item2"></div>
<div class="knife item3"></div>
</div>
<div class="lower">
<div class="knife l item00"></div>
<div class="knife l item11"></div>
<div class="knife l item22"></div>
<div class="knife l item33"></div>
</div>
</div>
<button class="jumpbutton">Jump</button>
<script src="script.js"></script>
</body>
</html>
137 changes: 137 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
var kite=document.querySelector('.kite');
var kite1=document.querySelector(".kite1");
var item0=document.querySelector(".item0");
var item1=document.querySelector(".item1");
var item2=document.querySelector(".item2");
var item3=document.querySelector(".item3");

var item00=document.querySelector(".item00");
var item11=document.querySelector(".item11");
var item22=document.querySelector(".item22");
var item33=document.querySelector(".item33");
var upper=document.querySelector(".upper");
var lower=document.querySelector(".lower");
var scorep=0;
var score=document.querySelector('.score');
var gameoptions=document.querySelector(".options");
var scorepp=0;
var yourscore=document.querySelector(".yourscore");
var replay=document.querySelector(".replay");
var backgroundaudio=new Audio("background_audio.mp3");
var jumpaudio=new Audio("jump.wav");
var deadaudio=new Audio("dead_sound.wav");
var jumpbutton=document.querySelector(".jumpbutton");
document.onkeydown=function(e)
{
if(e.key=="Enter")
{
backgroundaudio.play();
var dy=parseFloat(window.getComputedStyle(kite1,null).getPropertyValue('bottom'));
kite1.classList.remove("kite1");
kite.style.bottom=dy+8+"px";
setTimeout(()=>{
kite1.classList.add("kite1");
},100)
}
}
jumpbutton.addEventListener('click',()=>{

backgroundaudio.play();
var dy=parseFloat(window.getComputedStyle(kite1,null).getPropertyValue('bottom'));
kite1.classList.remove("kite1");
kite.style.bottom=dy+8+"px";
setTimeout(()=>{
kite1.classList.add("kite1");
},100)
});
setInterval(()=>{
dy=parseInt(window.getComputedStyle(kite,null).getPropertyValue('bottom'));
dx=parseInt(window.getComputedStyle(kite,null).getPropertyValue('left'));

dy1=parseInt(window.getComputedStyle(item0,null).getPropertyValue('bottom'));
dx1=parseInt(window.getComputedStyle(item0,null).getPropertyValue('left'));
var newdx1=Math.abs(dx1-dx);
var newdy1=dy1-(dy+40);

dy2=parseInt(window.getComputedStyle(item1,null).getPropertyValue('bottom'));
dx2=parseInt(window.getComputedStyle(item1,null).getPropertyValue('left'));
var newdx2=Math.abs(dx2-dx);
var newdy2=dy2-(dy+40);

dy3=parseInt(window.getComputedStyle(item2,null).getPropertyValue('bottom'));
dx3=parseInt(window.getComputedStyle(item2,null).getPropertyValue('left'));
var newdx3=Math.abs(dx3-dx);
var newdy3=dy3-(dy+40);

dy4=parseInt(window.getComputedStyle(item3,null).getPropertyValue('bottom'));
dx4=parseInt(window.getComputedStyle(item3,null).getPropertyValue('left'));
var newdx4=Math.abs(dx4-dx);
var newdy4=dy4-(dy+40);
//for lower
dy11=parseInt(window.getComputedStyle(item00,null).getPropertyValue('height'));
var newdy11=dy-dy11;

dy22=parseInt(window.getComputedStyle(item11,null).getPropertyValue('height'));
var newdy22=dy-dy22;

dy33=parseInt(window.getComputedStyle(item22,null).getPropertyValue('height'));
var newdy33=dy-dy33;

dy44=parseInt(window.getComputedStyle(item33,null).getPropertyValue('height'));
var newdy44=dy-dy44;


//for down

setInterval(()=>{
var out=parseInt(window.getComputedStyle(kite,null).getPropertyValue('bottom'));
if(out==0)
{

kite.style.display="none";
lower.style.display="none";
upper.style.display="none";
score.style.display="none";
gameoptions.style.display="grid";
deadaudio.play();

yourscore.innerHTML="Your Score:"+scorep;
backgroundaudio.pause();
backgroundaudio.currentTime=0;
}
},500);

if((newdy1<=0 && newdx1<20) || (newdy2<=0 && newdx2<20) || (newdy3<=0 && newdx3<20) || (newdy4<=0 && newdx4<20) || (newdy11<=0 && newdx1<20) || (newdy22<=0 && newdx2<20) || (newdy33<=0 && newdx3<20) || (newdy44<=0 && newdx4<20))
{
backgroundaudio.pause();
backgroundaudio.currentTime=0;
kite.style.display="none";
lower.style.display="none";
upper.style.display="none";
score.style.display="none";
gameoptions.style.display="grid";
yourscore.innerHTML="Your Score:"+(--scorep);
deadaudio.play();
}


},0);

setTimeout(()=>{
function f1()
{

score.innerHTML="Score: "+scorep;
scorep++;

setTimeout(f1,2500);

}

f1();
},6500);

replay.addEventListener('click',()=>{
window.location.reload();

})
Loading

0 comments on commit 72acb6c

Please sign in to comment.