new comedy game
6
flappyplane/ajax/libs/jquery/1.11.3/jquery.min.js
vendored
Normal file
1
flappyplane/ajax/libs/jquery/1.11.3/jquery.min.map
Normal file
BIN
flappyplane/assets/bird.png
Normal file
After Width: | Height: | Size: 282 B |
BIN
flappyplane/assets/ceiling.png
Normal file
After Width: | Height: | Size: 318 B |
BIN
flappyplane/assets/explosion.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
flappyplane/assets/font_big_0.png
Normal file
After Width: | Height: | Size: 121 B |
BIN
flappyplane/assets/font_big_1.png
Normal file
After Width: | Height: | Size: 130 B |
BIN
flappyplane/assets/font_big_2.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
flappyplane/assets/font_big_3.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
flappyplane/assets/font_big_4.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
flappyplane/assets/font_big_5.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
flappyplane/assets/font_big_6.png
Normal file
After Width: | Height: | Size: 126 B |
BIN
flappyplane/assets/font_big_7.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
flappyplane/assets/font_big_8.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
flappyplane/assets/font_big_9.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
flappyplane/assets/font_small_0.png
Normal file
After Width: | Height: | Size: 99 B |
BIN
flappyplane/assets/font_small_1.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
flappyplane/assets/font_small_2.png
Normal file
After Width: | Height: | Size: 96 B |
BIN
flappyplane/assets/font_small_3.png
Normal file
After Width: | Height: | Size: 90 B |
BIN
flappyplane/assets/font_small_4.png
Normal file
After Width: | Height: | Size: 112 B |
BIN
flappyplane/assets/font_small_5.png
Normal file
After Width: | Height: | Size: 94 B |
BIN
flappyplane/assets/font_small_6.png
Normal file
After Width: | Height: | Size: 92 B |
BIN
flappyplane/assets/font_small_7.png
Normal file
After Width: | Height: | Size: 94 B |
BIN
flappyplane/assets/font_small_8.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
flappyplane/assets/font_small_9.png
Normal file
After Width: | Height: | Size: 100 B |
BIN
flappyplane/assets/land.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
flappyplane/assets/medal_bronze.png
Normal file
After Width: | Height: | Size: 354 B |
BIN
flappyplane/assets/medal_gold.png
Normal file
After Width: | Height: | Size: 995 B |
BIN
flappyplane/assets/medal_platinum.png
Normal file
After Width: | Height: | Size: 962 B |
BIN
flappyplane/assets/medal_silver.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
flappyplane/assets/pipe-down.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
flappyplane/assets/pipe-up.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
flappyplane/assets/pipe.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
flappyplane/assets/plane.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
flappyplane/assets/replay.png
Normal file
After Width: | Height: | Size: 419 B |
BIN
flappyplane/assets/scoreboard.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
flappyplane/assets/sky.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
flappyplane/assets/sounds/nasheed.ogg
Normal file
BIN
flappyplane/assets/sounds/sfx_die.ogg
Normal file
BIN
flappyplane/assets/sounds/sfx_hit.ogg
Normal file
BIN
flappyplane/assets/sounds/sfx_point.ogg
Normal file
BIN
flappyplane/assets/sounds/sfx_swooshing.ogg
Normal file
BIN
flappyplane/assets/sounds/sfx_wing.ogg
Normal file
BIN
flappyplane/assets/splash.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
flappyplane/assets/thumb.png
Normal file
After Width: | Height: | Size: 15 KiB |
402
flappyplane/css/main.css
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
@-webkit-keyframes animLand {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -335px 0px; }
|
||||||
|
}
|
||||||
|
@-moz-keyframes animLand {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -335px 0px; }
|
||||||
|
}
|
||||||
|
@-o-keyframes animLand {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -335px 0px; }
|
||||||
|
}
|
||||||
|
@keyframes animLand {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -335px 0px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes animSky {
|
||||||
|
0% { background-position: 0px 100%; }
|
||||||
|
100% { background-position: -275px 100%; }
|
||||||
|
}
|
||||||
|
@-moz-keyframes animSky {
|
||||||
|
0% { background-position: 0px 100%; }
|
||||||
|
100% { background-position: -275px 100%; }
|
||||||
|
}
|
||||||
|
@-o-keyframes animSky {
|
||||||
|
0% { background-position: 0px 100%; }
|
||||||
|
100% { background-position: -275px 100%; }
|
||||||
|
}
|
||||||
|
@keyframes animSky {
|
||||||
|
0% { background-position: 0px 100%; }
|
||||||
|
100% { background-position: -275px 100%; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes animBird {
|
||||||
|
from { background-position: 0px 0px; }
|
||||||
|
to { background-position: 0px -96px; }
|
||||||
|
}
|
||||||
|
@-moz-keyframes animBird {
|
||||||
|
from { background-position: 0px 0px; }
|
||||||
|
to { background-position: 0px -96px; }
|
||||||
|
}
|
||||||
|
@-o-keyframes animBird {
|
||||||
|
from { background-position: 0px 0px; }
|
||||||
|
to { background-position: 0px -96px; }
|
||||||
|
}
|
||||||
|
@keyframes animBird {
|
||||||
|
from { background-position: 0px 0px; }
|
||||||
|
to { background-position: 0px -96px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes animPipe {
|
||||||
|
0% { left: 900px; }
|
||||||
|
100% { left: -100px; }
|
||||||
|
}
|
||||||
|
@-moz-keyframes animPipe {
|
||||||
|
0% { left: 900px; }
|
||||||
|
100% { left: -100px; }
|
||||||
|
}
|
||||||
|
@-o-keyframes animPipe {
|
||||||
|
0% { left: 900px; }
|
||||||
|
100% { left: -100px; }
|
||||||
|
}
|
||||||
|
@keyframes animPipe {
|
||||||
|
0% { left: 900px; }
|
||||||
|
100% { left: -100px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes animCeiling {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -63px 0px; }
|
||||||
|
}
|
||||||
|
@-moz-keyframes animCeiling {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -63px 0px; }
|
||||||
|
}
|
||||||
|
@-o-keyframes animCeiling {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -63px 0px; }
|
||||||
|
}
|
||||||
|
@keyframes animCeiling {
|
||||||
|
0% { background-position: 0px 0px; }
|
||||||
|
100% { background-position: -63px 0px; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
*,
|
||||||
|
*:before,
|
||||||
|
*:after
|
||||||
|
{
|
||||||
|
/* border box */
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
/* gpu acceleration */
|
||||||
|
-webkit-transition: translate3d(0,0,0);
|
||||||
|
/* select disable */
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body
|
||||||
|
{
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #fff;
|
||||||
|
background:#111;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#gamecontainer
|
||||||
|
{
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
min-height: 525px;
|
||||||
|
}
|
||||||
|
@media (min-width: 1025px){
|
||||||
|
#gamecontainer
|
||||||
|
{
|
||||||
|
width:500px;
|
||||||
|
overflow:hidden;
|
||||||
|
margin:0 auto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Screen - Game
|
||||||
|
*/
|
||||||
|
#gamescreen
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#sky
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 80%;
|
||||||
|
background-image: url('../assets/sky.png');
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
background-position: 0px 100%;
|
||||||
|
background-color: #426dbd;
|
||||||
|
|
||||||
|
-webkit-animation: animSky 7s linear infinite;
|
||||||
|
animation: animSky 7s linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
#flyarea
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
height: 420px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ceiling
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
top: -16px;
|
||||||
|
height: 16px;
|
||||||
|
width: 100%;
|
||||||
|
background-image: url('../assets/ceiling.png');
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
|
||||||
|
-webkit-animation: animCeiling 481ms linear infinite;
|
||||||
|
animation: animCeiling 481ms linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
#land
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 20%;
|
||||||
|
background-image: url('../assets/land.png');
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
background-position: 0px 0px;
|
||||||
|
background-color: #0f2641;
|
||||||
|
|
||||||
|
-webkit-animation: animLand 2516ms linear infinite;
|
||||||
|
animation: animLand 2516ms linear infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bigscore
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
top: 20px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left:-20px;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bigscore img
|
||||||
|
{
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#splash
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
top: 75px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left:-94px;
|
||||||
|
width: 188px;
|
||||||
|
height: 170px;
|
||||||
|
background-image: url('../assets/splash.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
#scoreboard
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
top: 64px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left:-119px;
|
||||||
|
width: 236px;
|
||||||
|
height: 280px;
|
||||||
|
background-image: url('../assets/scoreboard.png');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#medal
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
top: 114px;
|
||||||
|
left: 32px;
|
||||||
|
width: 44px;
|
||||||
|
height: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#currentscore
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
top: 105px;
|
||||||
|
left: 107px;
|
||||||
|
width: 104px;
|
||||||
|
height: 14px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#currentscore img
|
||||||
|
{
|
||||||
|
padding-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#highscore
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
top: 147px;
|
||||||
|
left: 107px;
|
||||||
|
width: 104px;
|
||||||
|
height: 14px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#highscore img
|
||||||
|
{
|
||||||
|
padding-left: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#replay
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
top: 205px;
|
||||||
|
left: 61px;
|
||||||
|
height: 115px;
|
||||||
|
width: 70px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.boundingbox
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
display: none;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border: 1px solid red;
|
||||||
|
}
|
||||||
|
|
||||||
|
#player
|
||||||
|
{
|
||||||
|
left: 60px;
|
||||||
|
top: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bird
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
width: 93px;
|
||||||
|
height: 24px;
|
||||||
|
background-image: url('../assets/bird.png');
|
||||||
|
background-image: url('../assets/plane.png');
|
||||||
|
|
||||||
|
-webkit-animation: animBird 300ms steps(4) infinite;
|
||||||
|
animation: animBird 300ms steps(4) infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
left: -100px;
|
||||||
|
width: 52px;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 10;
|
||||||
|
|
||||||
|
-webkit-animation: animPipe 7500ms linear;
|
||||||
|
animation: animPipe 7500ms linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe_upper
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 52px;
|
||||||
|
background-image: url('../assets/pipe.png');
|
||||||
|
background-repeat: repeat-y;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe_upper:after
|
||||||
|
{
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 52px;
|
||||||
|
height: 22px;
|
||||||
|
background-image: url('../assets/pipe-down.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe_lower
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
width: 52px;
|
||||||
|
background-image: url('../assets/pipe.png');
|
||||||
|
background-repeat: repeat-y;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pipe_lower:after
|
||||||
|
{
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 52px;
|
||||||
|
height: 22px;
|
||||||
|
background-image: url('../assets/pipe-up.png');
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer
|
||||||
|
{
|
||||||
|
position: absolute;
|
||||||
|
bottom: 3px;
|
||||||
|
left: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#footer a,
|
||||||
|
#footer a:link,
|
||||||
|
#footer a:visited,
|
||||||
|
#footer a:hover,
|
||||||
|
#footer a:active
|
||||||
|
{
|
||||||
|
display: block;
|
||||||
|
padding: 2px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
#explosion {
|
||||||
|
width: 188px;
|
||||||
|
height: 142px;
|
||||||
|
position : absolute;
|
||||||
|
margin-top:-50px;
|
||||||
|
background-image: url("../assets/explosion.png");
|
||||||
|
z-index:99;
|
||||||
|
}
|
2
flappyplane/css/reset.css
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/* html5doctor.com Reset v1.6.1 - http://cssreset.com */
|
||||||
|
html,body,div,span,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,samp,small,strong,sub,sup,var,b,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}nav ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-style:italic;font-weight:bold}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-collapse:collapse;border-spacing:0}hr{display:block;height:1px;border:0;border-top:1px solid #ccc;margin:1em 0;padding:0}input,select{vertical-align:middle}
|
BIN
flappyplane/favicon.ico
Normal file
After Width: | Height: | Size: 150 KiB |
148
flappyplane/index.html
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>FLAPPY PLANE!</title>
|
||||||
|
<link rel="icon" href="favicon.ico" />
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||||
|
<meta name="author" content="Anonymous troll" />
|
||||||
|
<meta
|
||||||
|
name="description"
|
||||||
|
content="FLAPPY PLANE"
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
name="viewport"
|
||||||
|
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- Open Graph tags -->
|
||||||
|
<meta property="og:title" content="Flappy Plane, September edition" />
|
||||||
|
<meta
|
||||||
|
property="og:description"
|
||||||
|
content="FLAPPY PLANE OSAMA"
|
||||||
|
/>
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta
|
||||||
|
property="og:image"
|
||||||
|
content="https://github.com/irfaantx/terrorist.group/raw/main/assets/thumb.png"
|
||||||
|
/>
|
||||||
|
<meta property="og:url" content="https://irfaantx.github.io/terrorist.group" />
|
||||||
|
<meta property="og:site_name" content="FLAPPY PLANE!" />
|
||||||
|
<!-- Style sheets -->
|
||||||
|
<link href="css/reset.css" rel="stylesheet" />
|
||||||
|
<link href="css/main.css" rel="stylesheet" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
var switchTo5x = true;
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
stLight.options({
|
||||||
|
publisher: "2ae97540-b48e-49c1-9d0f-e9e34df112fe",
|
||||||
|
doNotHash: true,
|
||||||
|
doNotCopy: true,
|
||||||
|
hashAddressBar: false,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="gamecontainer">
|
||||||
|
<style type="text/css">
|
||||||
|
#legpad {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#smallpad {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#ip4ad {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#hdad {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
#leftad {
|
||||||
|
display: none;
|
||||||
|
float: left;
|
||||||
|
padding-left: 50px;
|
||||||
|
padding-top: 75px;
|
||||||
|
}
|
||||||
|
#rightad {
|
||||||
|
display: none;
|
||||||
|
float: right;
|
||||||
|
padding-right: 50px;
|
||||||
|
padding-top: 75px;
|
||||||
|
}
|
||||||
|
.largetab {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@media (orientation: portrait) and (min-width: 319px) and (max-width: 459px) {
|
||||||
|
#ip4ad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (orientation: portrait) and (min-width: 299px) and (max-width: 318px) {
|
||||||
|
#smallpad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (orientation: portrait) and (min-width: 200px) and (max-width: 298px) {
|
||||||
|
#legpad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (orientation: landscape) and (min-height: 600px) and (min-width: 1270px) {
|
||||||
|
#leftad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#rightad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
#hdad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (orientation: portrait) and (min-width: 760px) {
|
||||||
|
.largetab {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (orientation: portrait) and (min-width: 460px) and (max-width: 759px) {
|
||||||
|
#hdad {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div id="gamescreen">
|
||||||
|
<div id="sky" class="animated">
|
||||||
|
<div id="flyarea">
|
||||||
|
<div id="ceiling" class="animated"></div>
|
||||||
|
<!-- This is the flying and pipe area container -->
|
||||||
|
<div id="player" class="bird animated"></div>
|
||||||
|
|
||||||
|
<div id="bigscore"></div>
|
||||||
|
|
||||||
|
<div id="splash"></div>
|
||||||
|
|
||||||
|
<div id="scoreboard">
|
||||||
|
<div id="medal"></div>
|
||||||
|
<div id="currentscore"></div>
|
||||||
|
<div id="highscore"></div>
|
||||||
|
<div id="replay">
|
||||||
|
<img src="assets/replay.png" alt="replay" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Pipes go here! -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="land" class="animated"><div id="debug"></div></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div id="footer"></div>
|
||||||
|
<div class="boundingbox" id="playerbox"></div>
|
||||||
|
<div class="boundingbox" id="pipebox"></div>
|
||||||
|
|
||||||
|
<script src="ajax/libs/jquery/1.11.3/jquery.min.js"></script>
|
||||||
|
<script src="js/jquery.transit.min.js"></script>
|
||||||
|
<script src="js/buzz.min.js"></script>
|
||||||
|
<script src="js/main.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
516
flappyplane/js/buzz.min.js
vendored
Normal file
@ -0,0 +1,516 @@
|
|||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Buzz, a Javascript HTML5 Audio library
|
||||||
|
// v1.1.0 - released 2013-08-15 13:18
|
||||||
|
// Licensed under the MIT license.
|
||||||
|
// http://buzz.jaysalvat.com/
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright (C) 2010-2013 Jay Salvat
|
||||||
|
// http://jaysalvat.com/
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
(function (t, n, e) {
|
||||||
|
"undefined" != typeof module && module.exports
|
||||||
|
? (module.exports = e())
|
||||||
|
: "function" == typeof n.define && n.define.amd
|
||||||
|
? define(t, [], e)
|
||||||
|
: (n[t] = e());
|
||||||
|
})("buzz", this, function () {
|
||||||
|
var t = {
|
||||||
|
defaults: {
|
||||||
|
autoplay: !1,
|
||||||
|
duration: 5e3,
|
||||||
|
formats: [],
|
||||||
|
loop: !1,
|
||||||
|
placeholder: "--",
|
||||||
|
preload: "metadata",
|
||||||
|
volume: 80,
|
||||||
|
document: document,
|
||||||
|
},
|
||||||
|
types: {
|
||||||
|
mp3: "audio/mpeg",
|
||||||
|
ogg: "audio/ogg",
|
||||||
|
wav: "audio/wav",
|
||||||
|
aac: "audio/aac",
|
||||||
|
m4a: "audio/x-m4a",
|
||||||
|
},
|
||||||
|
sounds: [],
|
||||||
|
el: document.createElement("audio"),
|
||||||
|
sound: function (n, e) {
|
||||||
|
function i(t) {
|
||||||
|
for (var n = [], e = t.length - 1, i = 0; e >= i; i++)
|
||||||
|
n.push({ start: t.start(i), end: t.end(i) });
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
function u(t) {
|
||||||
|
return t.split(".").pop();
|
||||||
|
}
|
||||||
|
function s(n, e) {
|
||||||
|
var i = r.createElement("source");
|
||||||
|
(i.src = e),
|
||||||
|
t.types[u(e)] && (i.type = t.types[u(e)]),
|
||||||
|
n.appendChild(i);
|
||||||
|
}
|
||||||
|
e = e || {};
|
||||||
|
var r = e.document || t.defaults.document,
|
||||||
|
o = 0,
|
||||||
|
a = [],
|
||||||
|
h = {},
|
||||||
|
l = t.isSupported();
|
||||||
|
if (
|
||||||
|
((this.load = function () {
|
||||||
|
return l ? (this.sound.load(), this) : this;
|
||||||
|
}),
|
||||||
|
(this.play = function () {
|
||||||
|
return l ? (this.sound.play(), this) : this;
|
||||||
|
}),
|
||||||
|
(this.togglePlay = function () {
|
||||||
|
return l
|
||||||
|
? (this.sound.paused ? this.sound.play() : this.sound.pause(), this)
|
||||||
|
: this;
|
||||||
|
}),
|
||||||
|
(this.pause = function () {
|
||||||
|
return l ? (this.sound.pause(), this) : this;
|
||||||
|
}),
|
||||||
|
(this.isPaused = function () {
|
||||||
|
return l ? this.sound.paused : null;
|
||||||
|
}),
|
||||||
|
(this.stop = function () {
|
||||||
|
return l ? (this.setTime(0), this.sound.pause(), this) : this;
|
||||||
|
}),
|
||||||
|
(this.isEnded = function () {
|
||||||
|
return l ? this.sound.ended : null;
|
||||||
|
}),
|
||||||
|
(this.loop = function () {
|
||||||
|
return l
|
||||||
|
? ((this.sound.loop = "loop"),
|
||||||
|
this.bind("ended.buzzloop", function () {
|
||||||
|
(this.currentTime = 0), this.play();
|
||||||
|
}),
|
||||||
|
this)
|
||||||
|
: this;
|
||||||
|
}),
|
||||||
|
(this.unloop = function () {
|
||||||
|
return l
|
||||||
|
? (this.sound.removeAttribute("loop"),
|
||||||
|
this.unbind("ended.buzzloop"),
|
||||||
|
this)
|
||||||
|
: this;
|
||||||
|
}),
|
||||||
|
(this.mute = function () {
|
||||||
|
return l ? ((this.sound.muted = !0), this) : this;
|
||||||
|
}),
|
||||||
|
(this.unmute = function () {
|
||||||
|
return l ? ((this.sound.muted = !1), this) : this;
|
||||||
|
}),
|
||||||
|
(this.toggleMute = function () {
|
||||||
|
return l ? ((this.sound.muted = !this.sound.muted), this) : this;
|
||||||
|
}),
|
||||||
|
(this.isMuted = function () {
|
||||||
|
return l ? this.sound.muted : null;
|
||||||
|
}),
|
||||||
|
(this.setVolume = function (t) {
|
||||||
|
return l
|
||||||
|
? (0 > t && (t = 0),
|
||||||
|
t > 100 && (t = 100),
|
||||||
|
(this.volume = t),
|
||||||
|
(this.sound.volume = t / 100),
|
||||||
|
this)
|
||||||
|
: this;
|
||||||
|
}),
|
||||||
|
(this.getVolume = function () {
|
||||||
|
return l ? this.volume : this;
|
||||||
|
}),
|
||||||
|
(this.increaseVolume = function (t) {
|
||||||
|
return this.setVolume(this.volume + (t || 1));
|
||||||
|
}),
|
||||||
|
(this.decreaseVolume = function (t) {
|
||||||
|
return this.setVolume(this.volume - (t || 1));
|
||||||
|
}),
|
||||||
|
(this.setTime = function (t) {
|
||||||
|
if (!l) return this;
|
||||||
|
var n = !0;
|
||||||
|
return (
|
||||||
|
this.whenReady(function () {
|
||||||
|
n === !0 && ((n = !1), (this.sound.currentTime = t));
|
||||||
|
}),
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
(this.getTime = function () {
|
||||||
|
if (!l) return null;
|
||||||
|
var n = Math.round(100 * this.sound.currentTime) / 100;
|
||||||
|
return isNaN(n) ? t.defaults.placeholder : n;
|
||||||
|
}),
|
||||||
|
(this.setPercent = function (n) {
|
||||||
|
return l ? this.setTime(t.fromPercent(n, this.sound.duration)) : this;
|
||||||
|
}),
|
||||||
|
(this.getPercent = function () {
|
||||||
|
if (!l) return null;
|
||||||
|
var n = Math.round(
|
||||||
|
t.toPercent(this.sound.currentTime, this.sound.duration)
|
||||||
|
);
|
||||||
|
return isNaN(n) ? t.defaults.placeholder : n;
|
||||||
|
}),
|
||||||
|
(this.setSpeed = function (t) {
|
||||||
|
return l ? ((this.sound.playbackRate = t), this) : this;
|
||||||
|
}),
|
||||||
|
(this.getSpeed = function () {
|
||||||
|
return l ? this.sound.playbackRate : null;
|
||||||
|
}),
|
||||||
|
(this.getDuration = function () {
|
||||||
|
if (!l) return null;
|
||||||
|
var n = Math.round(100 * this.sound.duration) / 100;
|
||||||
|
return isNaN(n) ? t.defaults.placeholder : n;
|
||||||
|
}),
|
||||||
|
(this.getPlayed = function () {
|
||||||
|
return l ? i(this.sound.played) : null;
|
||||||
|
}),
|
||||||
|
(this.getBuffered = function () {
|
||||||
|
return l ? i(this.sound.buffered) : null;
|
||||||
|
}),
|
||||||
|
(this.getSeekable = function () {
|
||||||
|
return l ? i(this.sound.seekable) : null;
|
||||||
|
}),
|
||||||
|
(this.getErrorCode = function () {
|
||||||
|
return l && this.sound.error ? this.sound.error.code : 0;
|
||||||
|
}),
|
||||||
|
(this.getErrorMessage = function () {
|
||||||
|
if (!l) return null;
|
||||||
|
switch (this.getErrorCode()) {
|
||||||
|
case 1:
|
||||||
|
return "MEDIA_ERR_ABORTED";
|
||||||
|
case 2:
|
||||||
|
return "MEDIA_ERR_NETWORK";
|
||||||
|
case 3:
|
||||||
|
return "MEDIA_ERR_DECODE";
|
||||||
|
case 4:
|
||||||
|
return "MEDIA_ERR_SRC_NOT_SUPPORTED";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
(this.getStateCode = function () {
|
||||||
|
return l ? this.sound.readyState : null;
|
||||||
|
}),
|
||||||
|
(this.getStateMessage = function () {
|
||||||
|
if (!l) return null;
|
||||||
|
switch (this.getStateCode()) {
|
||||||
|
case 0:
|
||||||
|
return "HAVE_NOTHING";
|
||||||
|
case 1:
|
||||||
|
return "HAVE_METADATA";
|
||||||
|
case 2:
|
||||||
|
return "HAVE_CURRENT_DATA";
|
||||||
|
case 3:
|
||||||
|
return "HAVE_FUTURE_DATA";
|
||||||
|
case 4:
|
||||||
|
return "HAVE_ENOUGH_DATA";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
(this.getNetworkStateCode = function () {
|
||||||
|
return l ? this.sound.networkState : null;
|
||||||
|
}),
|
||||||
|
(this.getNetworkStateMessage = function () {
|
||||||
|
if (!l) return null;
|
||||||
|
switch (this.getNetworkStateCode()) {
|
||||||
|
case 0:
|
||||||
|
return "NETWORK_EMPTY";
|
||||||
|
case 1:
|
||||||
|
return "NETWORK_IDLE";
|
||||||
|
case 2:
|
||||||
|
return "NETWORK_LOADING";
|
||||||
|
case 3:
|
||||||
|
return "NETWORK_NO_SOURCE";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
(this.set = function (t, n) {
|
||||||
|
return l ? ((this.sound[t] = n), this) : this;
|
||||||
|
}),
|
||||||
|
(this.get = function (t) {
|
||||||
|
return l ? (t ? this.sound[t] : this.sound) : null;
|
||||||
|
}),
|
||||||
|
(this.bind = function (t, n) {
|
||||||
|
if (!l) return this;
|
||||||
|
t = t.split(" ");
|
||||||
|
for (
|
||||||
|
var e = this,
|
||||||
|
i = function (t) {
|
||||||
|
n.call(e, t);
|
||||||
|
},
|
||||||
|
u = 0;
|
||||||
|
t.length > u;
|
||||||
|
u++
|
||||||
|
) {
|
||||||
|
var s = t[u],
|
||||||
|
r = s;
|
||||||
|
(s = r.split(".")[0]),
|
||||||
|
a.push({ idx: r, func: i }),
|
||||||
|
this.sound.addEventListener(s, i, !0);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}),
|
||||||
|
(this.unbind = function (t) {
|
||||||
|
if (!l) return this;
|
||||||
|
t = t.split(" ");
|
||||||
|
for (var n = 0; t.length > n; n++)
|
||||||
|
for (var e = t[n], i = e.split(".")[0], u = 0; a.length > u; u++) {
|
||||||
|
var s = a[u].idx.split(".");
|
||||||
|
(a[u].idx == e || (s[1] && s[1] == e.replace(".", ""))) &&
|
||||||
|
(this.sound.removeEventListener(i, a[u].func, !0),
|
||||||
|
a.splice(u, 1));
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}),
|
||||||
|
(this.bindOnce = function (t, n) {
|
||||||
|
if (!l) return this;
|
||||||
|
var e = this;
|
||||||
|
return (
|
||||||
|
(h[o++] = !1),
|
||||||
|
this.bind(t + "." + o, function () {
|
||||||
|
h[o] || ((h[o] = !0), n.call(e)), e.unbind(t + "." + o);
|
||||||
|
}),
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
(this.trigger = function (t) {
|
||||||
|
if (!l) return this;
|
||||||
|
t = t.split(" ");
|
||||||
|
for (var n = 0; t.length > n; n++)
|
||||||
|
for (var e = t[n], i = 0; a.length > i; i++) {
|
||||||
|
var u = a[i].idx.split(".");
|
||||||
|
if (a[i].idx == e || (u[0] && u[0] == e.replace(".", ""))) {
|
||||||
|
var s = r.createEvent("HTMLEvents");
|
||||||
|
s.initEvent(u[0], !1, !0), this.sound.dispatchEvent(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}),
|
||||||
|
(this.fadeTo = function (n, e, i) {
|
||||||
|
function u() {
|
||||||
|
setTimeout(function () {
|
||||||
|
n > s && n > o.volume
|
||||||
|
? (o.setVolume((o.volume += 1)), u())
|
||||||
|
: s > n && o.volume > n
|
||||||
|
? (o.setVolume((o.volume -= 1)), u())
|
||||||
|
: i instanceof Function && i.apply(o);
|
||||||
|
}, r);
|
||||||
|
}
|
||||||
|
if (!l) return this;
|
||||||
|
e instanceof Function
|
||||||
|
? ((i = e), (e = t.defaults.duration))
|
||||||
|
: (e = e || t.defaults.duration);
|
||||||
|
var s = this.volume,
|
||||||
|
r = e / Math.abs(s - n),
|
||||||
|
o = this;
|
||||||
|
return (
|
||||||
|
this.play(),
|
||||||
|
this.whenReady(function () {
|
||||||
|
u();
|
||||||
|
}),
|
||||||
|
this
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
(this.fadeIn = function (t, n) {
|
||||||
|
return l ? this.setVolume(0).fadeTo(100, t, n) : this;
|
||||||
|
}),
|
||||||
|
(this.fadeOut = function (t, n) {
|
||||||
|
return l ? this.fadeTo(0, t, n) : this;
|
||||||
|
}),
|
||||||
|
(this.fadeWith = function (t, n) {
|
||||||
|
return l
|
||||||
|
? (this.fadeOut(n, function () {
|
||||||
|
this.stop();
|
||||||
|
}),
|
||||||
|
t.play().fadeIn(n),
|
||||||
|
this)
|
||||||
|
: this;
|
||||||
|
}),
|
||||||
|
(this.whenReady = function (t) {
|
||||||
|
if (!l) return null;
|
||||||
|
var n = this;
|
||||||
|
0 === this.sound.readyState
|
||||||
|
? this.bind("canplay.buzzwhenready", function () {
|
||||||
|
t.call(n);
|
||||||
|
})
|
||||||
|
: t.call(n);
|
||||||
|
}),
|
||||||
|
l && n)
|
||||||
|
) {
|
||||||
|
for (var d in t.defaults)
|
||||||
|
t.defaults.hasOwnProperty(d) && (e[d] = e[d] || t.defaults[d]);
|
||||||
|
if (((this.sound = r.createElement("audio")), n instanceof Array))
|
||||||
|
for (var c in n) n.hasOwnProperty(c) && s(this.sound, n[c]);
|
||||||
|
else if (e.formats.length)
|
||||||
|
for (var f in e.formats)
|
||||||
|
e.formats.hasOwnProperty(f) &&
|
||||||
|
s(this.sound, n + "." + e.formats[f]);
|
||||||
|
else s(this.sound, n);
|
||||||
|
e.loop && this.loop(),
|
||||||
|
e.autoplay && (this.sound.autoplay = "autoplay"),
|
||||||
|
(this.sound.preload =
|
||||||
|
e.preload === !0 ? "auto" : e.preload === !1 ? "none" : e.preload),
|
||||||
|
this.setVolume(e.volume),
|
||||||
|
t.sounds.push(this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
group: function (t) {
|
||||||
|
function n() {
|
||||||
|
for (
|
||||||
|
var n = e(null, arguments), i = n.shift(), u = 0;
|
||||||
|
t.length > u;
|
||||||
|
u++
|
||||||
|
)
|
||||||
|
t[u][i].apply(t[u], n);
|
||||||
|
}
|
||||||
|
function e(t, n) {
|
||||||
|
return t instanceof Array ? t : Array.prototype.slice.call(n);
|
||||||
|
}
|
||||||
|
(t = e(t, arguments)),
|
||||||
|
(this.getSounds = function () {
|
||||||
|
return t;
|
||||||
|
}),
|
||||||
|
(this.add = function (n) {
|
||||||
|
n = e(n, arguments);
|
||||||
|
for (var i = 0; n.length > i; i++) t.push(n[i]);
|
||||||
|
}),
|
||||||
|
(this.remove = function (n) {
|
||||||
|
n = e(n, arguments);
|
||||||
|
for (var i = 0; n.length > i; i++)
|
||||||
|
for (var u = 0; t.length > u; u++)
|
||||||
|
if (t[u] == n[i]) {
|
||||||
|
t.splice(u, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
(this.load = function () {
|
||||||
|
return n("load"), this;
|
||||||
|
}),
|
||||||
|
(this.play = function () {
|
||||||
|
return n("play"), this;
|
||||||
|
}),
|
||||||
|
(this.togglePlay = function () {
|
||||||
|
return n("togglePlay"), this;
|
||||||
|
}),
|
||||||
|
(this.pause = function (t) {
|
||||||
|
return n("pause", t), this;
|
||||||
|
}),
|
||||||
|
(this.stop = function () {
|
||||||
|
return n("stop"), this;
|
||||||
|
}),
|
||||||
|
(this.mute = function () {
|
||||||
|
return n("mute"), this;
|
||||||
|
}),
|
||||||
|
(this.unmute = function () {
|
||||||
|
return n("unmute"), this;
|
||||||
|
}),
|
||||||
|
(this.toggleMute = function () {
|
||||||
|
return n("toggleMute"), this;
|
||||||
|
}),
|
||||||
|
(this.setVolume = function (t) {
|
||||||
|
return n("setVolume", t), this;
|
||||||
|
}),
|
||||||
|
(this.increaseVolume = function (t) {
|
||||||
|
return n("increaseVolume", t), this;
|
||||||
|
}),
|
||||||
|
(this.decreaseVolume = function (t) {
|
||||||
|
return n("decreaseVolume", t), this;
|
||||||
|
}),
|
||||||
|
(this.loop = function () {
|
||||||
|
return n("loop"), this;
|
||||||
|
}),
|
||||||
|
(this.unloop = function () {
|
||||||
|
return n("unloop"), this;
|
||||||
|
}),
|
||||||
|
(this.setTime = function (t) {
|
||||||
|
return n("setTime", t), this;
|
||||||
|
}),
|
||||||
|
(this.set = function (t, e) {
|
||||||
|
return n("set", t, e), this;
|
||||||
|
}),
|
||||||
|
(this.bind = function (t, e) {
|
||||||
|
return n("bind", t, e), this;
|
||||||
|
}),
|
||||||
|
(this.unbind = function (t) {
|
||||||
|
return n("unbind", t), this;
|
||||||
|
}),
|
||||||
|
(this.bindOnce = function (t, e) {
|
||||||
|
return n("bindOnce", t, e), this;
|
||||||
|
}),
|
||||||
|
(this.trigger = function (t) {
|
||||||
|
return n("trigger", t), this;
|
||||||
|
}),
|
||||||
|
(this.fade = function (t, e, i, u) {
|
||||||
|
return n("fade", t, e, i, u), this;
|
||||||
|
}),
|
||||||
|
(this.fadeIn = function (t, e) {
|
||||||
|
return n("fadeIn", t, e), this;
|
||||||
|
}),
|
||||||
|
(this.fadeOut = function (t, e) {
|
||||||
|
return n("fadeOut", t, e), this;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
all: function () {
|
||||||
|
return new t.group(t.sounds);
|
||||||
|
},
|
||||||
|
isSupported: function () {
|
||||||
|
return !!t.el.canPlayType;
|
||||||
|
},
|
||||||
|
isOGGSupported: function () {
|
||||||
|
return (
|
||||||
|
!!t.el.canPlayType && t.el.canPlayType('audio/ogg; codecs="vorbis"')
|
||||||
|
);
|
||||||
|
},
|
||||||
|
isWAVSupported: function () {
|
||||||
|
return !!t.el.canPlayType && t.el.canPlayType('audio/wav; codecs="1"');
|
||||||
|
},
|
||||||
|
isMP3Supported: function () {
|
||||||
|
return !!t.el.canPlayType && t.el.canPlayType("audio/mpeg;");
|
||||||
|
},
|
||||||
|
isAACSupported: function () {
|
||||||
|
return (
|
||||||
|
!!t.el.canPlayType &&
|
||||||
|
(t.el.canPlayType("audio/x-m4a;") || t.el.canPlayType("audio/aac;"))
|
||||||
|
);
|
||||||
|
},
|
||||||
|
toTimer: function (t, n) {
|
||||||
|
var e, i, u;
|
||||||
|
return (
|
||||||
|
(e = Math.floor(t / 3600)),
|
||||||
|
(e = isNaN(e) ? "--" : e >= 10 ? e : "0" + e),
|
||||||
|
(i = n ? Math.floor((t / 60) % 60) : Math.floor(t / 60)),
|
||||||
|
(i = isNaN(i) ? "--" : i >= 10 ? i : "0" + i),
|
||||||
|
(u = Math.floor(t % 60)),
|
||||||
|
(u = isNaN(u) ? "--" : u >= 10 ? u : "0" + u),
|
||||||
|
n ? e + ":" + i + ":" + u : i + ":" + u
|
||||||
|
);
|
||||||
|
},
|
||||||
|
fromTimer: function (t) {
|
||||||
|
var n = ("" + t).split(":");
|
||||||
|
return (
|
||||||
|
n &&
|
||||||
|
3 == n.length &&
|
||||||
|
(t =
|
||||||
|
3600 * parseInt(n[0], 10) +
|
||||||
|
60 * parseInt(n[1], 10) +
|
||||||
|
parseInt(n[2], 10)),
|
||||||
|
n &&
|
||||||
|
2 == n.length &&
|
||||||
|
(t = 60 * parseInt(n[0], 10) + parseInt(n[1], 10)),
|
||||||
|
t
|
||||||
|
);
|
||||||
|
},
|
||||||
|
toPercent: function (t, n, e) {
|
||||||
|
var i = Math.pow(10, e || 0);
|
||||||
|
return Math.round(((100 * t) / n) * i) / i;
|
||||||
|
},
|
||||||
|
fromPercent: function (t, n, e) {
|
||||||
|
var i = Math.pow(10, e || 0);
|
||||||
|
return Math.round((n / 100) * t * i) / i;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return t;
|
||||||
|
});
|
458
flappyplane/js/jquery.transit.min.js
vendored
Normal file
@ -0,0 +1,458 @@
|
|||||||
|
/*!
|
||||||
|
* jQuery Transit - CSS3 transitions and transformations
|
||||||
|
* (c) 2011-2012 Rico Sta. Cruz <rico@ricostacruz.com>
|
||||||
|
* MIT Licensed.
|
||||||
|
*
|
||||||
|
* http://ricostacruz.com/jquery.transit
|
||||||
|
* http://github.com/rstacruz/jquery.transit
|
||||||
|
*/
|
||||||
|
(function (k) {
|
||||||
|
k.transit = {
|
||||||
|
version: "0.9.9",
|
||||||
|
propertyMap: {
|
||||||
|
marginLeft: "margin",
|
||||||
|
marginRight: "margin",
|
||||||
|
marginBottom: "margin",
|
||||||
|
marginTop: "margin",
|
||||||
|
paddingLeft: "padding",
|
||||||
|
paddingRight: "padding",
|
||||||
|
paddingBottom: "padding",
|
||||||
|
paddingTop: "padding",
|
||||||
|
},
|
||||||
|
enabled: true,
|
||||||
|
useTransitionEnd: false,
|
||||||
|
};
|
||||||
|
var d = document.createElement("div");
|
||||||
|
var q = {};
|
||||||
|
function b(v) {
|
||||||
|
if (v in d.style) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
var u = ["Moz", "Webkit", "O", "ms"];
|
||||||
|
var r = v.charAt(0).toUpperCase() + v.substr(1);
|
||||||
|
if (v in d.style) {
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
for (var t = 0; t < u.length; ++t) {
|
||||||
|
var s = u[t] + r;
|
||||||
|
if (s in d.style) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function e() {
|
||||||
|
d.style[q.transform] = "";
|
||||||
|
d.style[q.transform] = "rotateY(90deg)";
|
||||||
|
return d.style[q.transform] !== "";
|
||||||
|
}
|
||||||
|
var a = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
|
||||||
|
q.transition = b("transition");
|
||||||
|
q.transitionDelay = b("transitionDelay");
|
||||||
|
q.transform = b("transform");
|
||||||
|
q.transformOrigin = b("transformOrigin");
|
||||||
|
q.transform3d = e();
|
||||||
|
var i = {
|
||||||
|
transition: "transitionEnd",
|
||||||
|
MozTransition: "transitionend",
|
||||||
|
OTransition: "oTransitionEnd",
|
||||||
|
WebkitTransition: "webkitTransitionEnd",
|
||||||
|
msTransition: "MSTransitionEnd",
|
||||||
|
};
|
||||||
|
var f = (q.transitionEnd = i[q.transition] || null);
|
||||||
|
for (var p in q) {
|
||||||
|
if (q.hasOwnProperty(p) && typeof k.support[p] === "undefined") {
|
||||||
|
k.support[p] = q[p];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
d = null;
|
||||||
|
k.cssEase = {
|
||||||
|
_default: "ease",
|
||||||
|
in: "ease-in",
|
||||||
|
out: "ease-out",
|
||||||
|
"in-out": "ease-in-out",
|
||||||
|
snap: "cubic-bezier(0,1,.5,1)",
|
||||||
|
easeOutCubic: "cubic-bezier(.215,.61,.355,1)",
|
||||||
|
easeInOutCubic: "cubic-bezier(.645,.045,.355,1)",
|
||||||
|
easeInCirc: "cubic-bezier(.6,.04,.98,.335)",
|
||||||
|
easeOutCirc: "cubic-bezier(.075,.82,.165,1)",
|
||||||
|
easeInOutCirc: "cubic-bezier(.785,.135,.15,.86)",
|
||||||
|
easeInExpo: "cubic-bezier(.95,.05,.795,.035)",
|
||||||
|
easeOutExpo: "cubic-bezier(.19,1,.22,1)",
|
||||||
|
easeInOutExpo: "cubic-bezier(1,0,0,1)",
|
||||||
|
easeInQuad: "cubic-bezier(.55,.085,.68,.53)",
|
||||||
|
easeOutQuad: "cubic-bezier(.25,.46,.45,.94)",
|
||||||
|
easeInOutQuad: "cubic-bezier(.455,.03,.515,.955)",
|
||||||
|
easeInQuart: "cubic-bezier(.895,.03,.685,.22)",
|
||||||
|
easeOutQuart: "cubic-bezier(.165,.84,.44,1)",
|
||||||
|
easeInOutQuart: "cubic-bezier(.77,0,.175,1)",
|
||||||
|
easeInQuint: "cubic-bezier(.755,.05,.855,.06)",
|
||||||
|
easeOutQuint: "cubic-bezier(.23,1,.32,1)",
|
||||||
|
easeInOutQuint: "cubic-bezier(.86,0,.07,1)",
|
||||||
|
easeInSine: "cubic-bezier(.47,0,.745,.715)",
|
||||||
|
easeOutSine: "cubic-bezier(.39,.575,.565,1)",
|
||||||
|
easeInOutSine: "cubic-bezier(.445,.05,.55,.95)",
|
||||||
|
easeInBack: "cubic-bezier(.6,-.28,.735,.045)",
|
||||||
|
easeOutBack: "cubic-bezier(.175, .885,.32,1.275)",
|
||||||
|
easeInOutBack: "cubic-bezier(.68,-.55,.265,1.55)",
|
||||||
|
};
|
||||||
|
k.cssHooks["transit:transform"] = {
|
||||||
|
get: function (r) {
|
||||||
|
return k(r).data("transform") || new j();
|
||||||
|
},
|
||||||
|
set: function (s, r) {
|
||||||
|
var t = r;
|
||||||
|
if (!(t instanceof j)) {
|
||||||
|
t = new j(t);
|
||||||
|
}
|
||||||
|
if (q.transform === "WebkitTransform" && !a) {
|
||||||
|
s.style[q.transform] = t.toString(true);
|
||||||
|
} else {
|
||||||
|
s.style[q.transform] = t.toString();
|
||||||
|
}
|
||||||
|
k(s).data("transform", t);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
k.cssHooks.transform = { set: k.cssHooks["transit:transform"].set };
|
||||||
|
if (k.fn.jquery < "1.8") {
|
||||||
|
k.cssHooks.transformOrigin = {
|
||||||
|
get: function (r) {
|
||||||
|
return r.style[q.transformOrigin];
|
||||||
|
},
|
||||||
|
set: function (r, s) {
|
||||||
|
r.style[q.transformOrigin] = s;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
k.cssHooks.transition = {
|
||||||
|
get: function (r) {
|
||||||
|
return r.style[q.transition];
|
||||||
|
},
|
||||||
|
set: function (r, s) {
|
||||||
|
r.style[q.transition] = s;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
n("scale");
|
||||||
|
n("translate");
|
||||||
|
n("rotate");
|
||||||
|
n("rotateX");
|
||||||
|
n("rotateY");
|
||||||
|
n("rotate3d");
|
||||||
|
n("perspective");
|
||||||
|
n("skewX");
|
||||||
|
n("skewY");
|
||||||
|
n("x", true);
|
||||||
|
n("y", true);
|
||||||
|
function j(r) {
|
||||||
|
if (typeof r === "string") {
|
||||||
|
this.parse(r);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
j.prototype = {
|
||||||
|
setFromString: function (t, s) {
|
||||||
|
var r =
|
||||||
|
typeof s === "string"
|
||||||
|
? s.split(",")
|
||||||
|
: s.constructor === Array
|
||||||
|
? s
|
||||||
|
: [s];
|
||||||
|
r.unshift(t);
|
||||||
|
j.prototype.set.apply(this, r);
|
||||||
|
},
|
||||||
|
set: function (s) {
|
||||||
|
var r = Array.prototype.slice.apply(arguments, [1]);
|
||||||
|
if (this.setter[s]) {
|
||||||
|
this.setter[s].apply(this, r);
|
||||||
|
} else {
|
||||||
|
this[s] = r.join(",");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
get: function (r) {
|
||||||
|
if (this.getter[r]) {
|
||||||
|
return this.getter[r].apply(this);
|
||||||
|
} else {
|
||||||
|
return this[r] || 0;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
setter: {
|
||||||
|
rotate: function (r) {
|
||||||
|
this.rotate = o(r, "deg");
|
||||||
|
},
|
||||||
|
rotateX: function (r) {
|
||||||
|
this.rotateX = o(r, "deg");
|
||||||
|
},
|
||||||
|
rotateY: function (r) {
|
||||||
|
this.rotateY = o(r, "deg");
|
||||||
|
},
|
||||||
|
scale: function (r, s) {
|
||||||
|
if (s === undefined) {
|
||||||
|
s = r;
|
||||||
|
}
|
||||||
|
this.scale = r + "," + s;
|
||||||
|
},
|
||||||
|
skewX: function (r) {
|
||||||
|
this.skewX = o(r, "deg");
|
||||||
|
},
|
||||||
|
skewY: function (r) {
|
||||||
|
this.skewY = o(r, "deg");
|
||||||
|
},
|
||||||
|
perspective: function (r) {
|
||||||
|
this.perspective = o(r, "px");
|
||||||
|
},
|
||||||
|
x: function (r) {
|
||||||
|
this.set("translate", r, null);
|
||||||
|
},
|
||||||
|
y: function (r) {
|
||||||
|
this.set("translate", null, r);
|
||||||
|
},
|
||||||
|
translate: function (r, s) {
|
||||||
|
if (this._translateX === undefined) {
|
||||||
|
this._translateX = 0;
|
||||||
|
}
|
||||||
|
if (this._translateY === undefined) {
|
||||||
|
this._translateY = 0;
|
||||||
|
}
|
||||||
|
if (r !== null && r !== undefined) {
|
||||||
|
this._translateX = o(r, "px");
|
||||||
|
}
|
||||||
|
if (s !== null && s !== undefined) {
|
||||||
|
this._translateY = o(s, "px");
|
||||||
|
}
|
||||||
|
this.translate = this._translateX + "," + this._translateY;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
getter: {
|
||||||
|
x: function () {
|
||||||
|
return this._translateX || 0;
|
||||||
|
},
|
||||||
|
y: function () {
|
||||||
|
return this._translateY || 0;
|
||||||
|
},
|
||||||
|
scale: function () {
|
||||||
|
var r = (this.scale || "1,1").split(",");
|
||||||
|
if (r[0]) {
|
||||||
|
r[0] = parseFloat(r[0]);
|
||||||
|
}
|
||||||
|
if (r[1]) {
|
||||||
|
r[1] = parseFloat(r[1]);
|
||||||
|
}
|
||||||
|
return r[0] === r[1] ? r[0] : r;
|
||||||
|
},
|
||||||
|
rotate3d: function () {
|
||||||
|
var t = (this.rotate3d || "0,0,0,0deg").split(",");
|
||||||
|
for (var r = 0; r <= 3; ++r) {
|
||||||
|
if (t[r]) {
|
||||||
|
t[r] = parseFloat(t[r]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t[3]) {
|
||||||
|
t[3] = o(t[3], "deg");
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
parse: function (s) {
|
||||||
|
var r = this;
|
||||||
|
s.replace(/([a-zA-Z0-9]+)\((.*?)\)/g, function (t, v, u) {
|
||||||
|
r.setFromString(v, u);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
toString: function (t) {
|
||||||
|
var s = [];
|
||||||
|
for (var r in this) {
|
||||||
|
if (this.hasOwnProperty(r)) {
|
||||||
|
if (
|
||||||
|
!q.transform3d &&
|
||||||
|
(r === "rotateX" ||
|
||||||
|
r === "rotateY" ||
|
||||||
|
r === "perspective" ||
|
||||||
|
r === "transformOrigin")
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (r[0] !== "_") {
|
||||||
|
if (t && r === "scale") {
|
||||||
|
s.push(r + "3d(" + this[r] + ",1)");
|
||||||
|
} else {
|
||||||
|
if (t && r === "translate") {
|
||||||
|
s.push(r + "3d(" + this[r] + ",0)");
|
||||||
|
} else {
|
||||||
|
s.push(r + "(" + this[r] + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s.join(" ");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
function m(s, r, t) {
|
||||||
|
if (r === true) {
|
||||||
|
s.queue(t);
|
||||||
|
} else {
|
||||||
|
if (r) {
|
||||||
|
s.queue(r, t);
|
||||||
|
} else {
|
||||||
|
t();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function h(s) {
|
||||||
|
var r = [];
|
||||||
|
k.each(s, function (t) {
|
||||||
|
t = k.camelCase(t);
|
||||||
|
t = k.transit.propertyMap[t] || k.cssProps[t] || t;
|
||||||
|
t = c(t);
|
||||||
|
if (k.inArray(t, r) === -1) {
|
||||||
|
r.push(t);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
function g(s, v, x, r) {
|
||||||
|
var t = h(s);
|
||||||
|
if (k.cssEase[x]) {
|
||||||
|
x = k.cssEase[x];
|
||||||
|
}
|
||||||
|
var w = "" + l(v) + " " + x;
|
||||||
|
if (parseInt(r, 10) > 0) {
|
||||||
|
w += " " + l(r);
|
||||||
|
}
|
||||||
|
var u = [];
|
||||||
|
k.each(t, function (z, y) {
|
||||||
|
u.push(y + " " + w);
|
||||||
|
});
|
||||||
|
return u.join(", ");
|
||||||
|
}
|
||||||
|
k.fn.transition = k.fn.transit = function (z, s, y, C) {
|
||||||
|
var D = this;
|
||||||
|
var u = 0;
|
||||||
|
var w = true;
|
||||||
|
if (typeof s === "function") {
|
||||||
|
C = s;
|
||||||
|
s = undefined;
|
||||||
|
}
|
||||||
|
if (typeof y === "function") {
|
||||||
|
C = y;
|
||||||
|
y = undefined;
|
||||||
|
}
|
||||||
|
if (typeof z.easing !== "undefined") {
|
||||||
|
y = z.easing;
|
||||||
|
delete z.easing;
|
||||||
|
}
|
||||||
|
if (typeof z.duration !== "undefined") {
|
||||||
|
s = z.duration;
|
||||||
|
delete z.duration;
|
||||||
|
}
|
||||||
|
if (typeof z.complete !== "undefined") {
|
||||||
|
C = z.complete;
|
||||||
|
delete z.complete;
|
||||||
|
}
|
||||||
|
if (typeof z.queue !== "undefined") {
|
||||||
|
w = z.queue;
|
||||||
|
delete z.queue;
|
||||||
|
}
|
||||||
|
if (typeof z.delay !== "undefined") {
|
||||||
|
u = z.delay;
|
||||||
|
delete z.delay;
|
||||||
|
}
|
||||||
|
if (typeof s === "undefined") {
|
||||||
|
s = k.fx.speeds._default;
|
||||||
|
}
|
||||||
|
if (typeof y === "undefined") {
|
||||||
|
y = k.cssEase._default;
|
||||||
|
}
|
||||||
|
s = l(s);
|
||||||
|
var E = g(z, s, y, u);
|
||||||
|
var B = k.transit.enabled && q.transition;
|
||||||
|
var t = B ? parseInt(s, 10) + parseInt(u, 10) : 0;
|
||||||
|
if (t === 0) {
|
||||||
|
var A = function (F) {
|
||||||
|
D.css(z);
|
||||||
|
if (C) {
|
||||||
|
C.apply(D);
|
||||||
|
}
|
||||||
|
if (F) {
|
||||||
|
F();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
m(D, w, A);
|
||||||
|
return D;
|
||||||
|
}
|
||||||
|
var x = {};
|
||||||
|
var r = function (H) {
|
||||||
|
var G = false;
|
||||||
|
var F = function () {
|
||||||
|
if (G) {
|
||||||
|
D.unbind(f, F);
|
||||||
|
}
|
||||||
|
if (t > 0) {
|
||||||
|
D.each(function () {
|
||||||
|
this.style[q.transition] = x[this] || null;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (typeof C === "function") {
|
||||||
|
C.apply(D);
|
||||||
|
}
|
||||||
|
if (typeof H === "function") {
|
||||||
|
H();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (t > 0 && f && k.transit.useTransitionEnd) {
|
||||||
|
G = true;
|
||||||
|
D.bind(f, F);
|
||||||
|
} else {
|
||||||
|
window.setTimeout(F, t);
|
||||||
|
}
|
||||||
|
D.each(function () {
|
||||||
|
if (t > 0) {
|
||||||
|
this.style[q.transition] = E;
|
||||||
|
}
|
||||||
|
k(this).css(z);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
var v = function (F) {
|
||||||
|
this.offsetWidth;
|
||||||
|
r(F);
|
||||||
|
};
|
||||||
|
m(D, w, v);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
function n(s, r) {
|
||||||
|
if (!r) {
|
||||||
|
k.cssNumber[s] = true;
|
||||||
|
}
|
||||||
|
k.transit.propertyMap[s] = q.transform;
|
||||||
|
k.cssHooks[s] = {
|
||||||
|
get: function (v) {
|
||||||
|
var u = k(v).css("transit:transform");
|
||||||
|
return u.get(s);
|
||||||
|
},
|
||||||
|
set: function (v, w) {
|
||||||
|
var u = k(v).css("transit:transform");
|
||||||
|
u.setFromString(s, w);
|
||||||
|
k(v).css({ "transit:transform": u });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function c(r) {
|
||||||
|
return r.replace(/([A-Z])/g, function (s) {
|
||||||
|
return "-" + s.toLowerCase();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function o(s, r) {
|
||||||
|
if (typeof s === "string" && !s.match(/^[\-0-9\.]+$/)) {
|
||||||
|
return s;
|
||||||
|
} else {
|
||||||
|
return "" + s + r;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function l(s) {
|
||||||
|
var r = s;
|
||||||
|
if (k.fx.speeds[r]) {
|
||||||
|
r = k.fx.speeds[r];
|
||||||
|
}
|
||||||
|
return o(r, "ms");
|
||||||
|
}
|
||||||
|
k.transit.getTransitionValue = g;
|
||||||
|
})(jQuery);
|
300
flappyplane/js/main.min.js
vendored
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
function getCookie(e) {
|
||||||
|
for (
|
||||||
|
var o = e + "=", t = document.cookie.split(";"), s = 0;
|
||||||
|
s < t.length;
|
||||||
|
s++
|
||||||
|
) {
|
||||||
|
var a = t[s].trim();
|
||||||
|
if (0 == a.indexOf(o)) return a.substring(o.length, a.length);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
function setCookie(e, o, t) {
|
||||||
|
var s = new Date();
|
||||||
|
s.setTime(s.getTime() + 24 * t * 60 * 60 * 1e3);
|
||||||
|
var a = "expires=" + s.toGMTString();
|
||||||
|
document.cookie = e + "=" + o + "; " + a;
|
||||||
|
}
|
||||||
|
function showSplash() {
|
||||||
|
(currentstate = states.SplashScreen),
|
||||||
|
(velocity = 0),
|
||||||
|
(position = 180),
|
||||||
|
(rotation = 0),
|
||||||
|
(score = 0),
|
||||||
|
$("#player").css({ y: 0, x: 0 }),
|
||||||
|
updatePlayer($("#player")),
|
||||||
|
soundSwoosh.stop(),
|
||||||
|
soundSwoosh.play(),
|
||||||
|
$(".pipe").remove(),
|
||||||
|
(pipes = new Array()),
|
||||||
|
$(".animated").css("animation-play-state", "running"),
|
||||||
|
$(".animated").css("-webkit-animation-play-state", "running"),
|
||||||
|
$("#splash").transition({ opacity: 1 }, 2e3, "ease");
|
||||||
|
}
|
||||||
|
function startGame() {
|
||||||
|
(currentstate = states.GameScreen),
|
||||||
|
soundHit.play(),
|
||||||
|
soundHit.stop(),
|
||||||
|
$("#splash").stop(),
|
||||||
|
$("#splash").transition({ opacity: 0 }, 500, "ease"),
|
||||||
|
setBigScore(),
|
||||||
|
debugmode && $(".boundingbox").show();
|
||||||
|
var e = 1e3 / 60;
|
||||||
|
(loopGameloop = setInterval(gameloop, e)),
|
||||||
|
(loopPipeloop = setInterval(updatePipes, 1400)),
|
||||||
|
playerJump(),
|
||||||
|
soundNasheed.stop(),
|
||||||
|
soundNasheed.play();
|
||||||
|
}
|
||||||
|
function updatePlayer(e) {
|
||||||
|
(rotation = Math.min((velocity / 10) * 40, 40)),
|
||||||
|
$(e).css({ rotate: rotation, top: position });
|
||||||
|
}
|
||||||
|
function gameloop() {
|
||||||
|
var e = $("#player");
|
||||||
|
(velocity += gravity), (position += velocity), updatePlayer(e);
|
||||||
|
var o = document.getElementById("player").getBoundingClientRect(),
|
||||||
|
t = 34,
|
||||||
|
s = 24,
|
||||||
|
a = t - 8 * Math.sin(Math.abs(rotation) / 90),
|
||||||
|
i = (s + o.height) / 2,
|
||||||
|
n = (o.width - a) / 2 + o.left,
|
||||||
|
r = (o.height - i) / 2 + o.top,
|
||||||
|
p = n + a,
|
||||||
|
c = r + i;
|
||||||
|
if (debugmode) {
|
||||||
|
var l = $("#playerbox");
|
||||||
|
l.css("left", n), l.css("top", r), l.css("height", i), l.css("width", a);
|
||||||
|
}
|
||||||
|
if (o.bottom >= $("#land").offset().top) return void playerDead();
|
||||||
|
var u = $("#ceiling");
|
||||||
|
if ((r <= u.offset().top + u.height() && (position = 0), null != pipes[0])) {
|
||||||
|
var d = pipes[0],
|
||||||
|
h = d.children(".pipe_upper"),
|
||||||
|
m = h.offset().top + h.height(),
|
||||||
|
y = h.offset().left - 2,
|
||||||
|
g = y + pipewidth,
|
||||||
|
f = m + pipeheight;
|
||||||
|
if (debugmode) {
|
||||||
|
var l = $("#pipebox");
|
||||||
|
l.css("left", y),
|
||||||
|
l.css("top", m),
|
||||||
|
l.css("height", pipeheight),
|
||||||
|
l.css("width", pipewidth);
|
||||||
|
}
|
||||||
|
return p > y && !(r > m && f > c)
|
||||||
|
? void playerDead()
|
||||||
|
: void (n > g && (pipes.splice(0, 1), playerScore()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function screenClick() {
|
||||||
|
currentstate == states.GameScreen
|
||||||
|
? playerJump()
|
||||||
|
: currentstate == states.SplashScreen && startGame();
|
||||||
|
}
|
||||||
|
function playerJump() {
|
||||||
|
(velocity = jump), soundJump.stop(), soundJump.play();
|
||||||
|
}
|
||||||
|
function setBigScore(e) {
|
||||||
|
var o = $("#bigscore");
|
||||||
|
if ((o.empty(), !e))
|
||||||
|
for (var t = score.toString().split(""), s = 0; s < t.length; s++)
|
||||||
|
o.append(
|
||||||
|
"<img src='assets/font_big_" + t[s] + ".png' alt='" + t[s] + "'>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function setSmallScore() {
|
||||||
|
var e = $("#currentscore");
|
||||||
|
e.empty();
|
||||||
|
for (var o = score.toString().split(""), t = 0; t < o.length; t++)
|
||||||
|
e.append(
|
||||||
|
"<img src='assets/font_small_" + o[t] + ".png' alt='" + o[t] + "'>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function setHighScore() {
|
||||||
|
var e = $("#highscore");
|
||||||
|
e.empty();
|
||||||
|
for (var o = highscore.toString().split(""), t = 0; t < o.length; t++)
|
||||||
|
e.append(
|
||||||
|
"<img src='assets/font_small_" + o[t] + ".png' alt='" + o[t] + "'>"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function setMedal() {
|
||||||
|
var e = $("#medal");
|
||||||
|
return (
|
||||||
|
e.empty(),
|
||||||
|
10 > score
|
||||||
|
? !1
|
||||||
|
: (score >= 10 && (medal = "bronze"),
|
||||||
|
score >= 20 && (medal = "silver"),
|
||||||
|
score >= 30 && (medal = "gold"),
|
||||||
|
score >= 40 && (medal = "platinum"),
|
||||||
|
e.append(
|
||||||
|
'<img src="assets/medal_' + medal + '.png" alt="' + medal + '">'
|
||||||
|
),
|
||||||
|
!0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
function playerDead() {
|
||||||
|
$(".animated").css("animation-play-state", "paused"),
|
||||||
|
$(".animated").css("-webkit-animation-play-state", "paused");
|
||||||
|
var e = $(
|
||||||
|
'<div id="explosion" style="top: ' +
|
||||||
|
$("#player").position().top +
|
||||||
|
'px; left:60px;"></div>'
|
||||||
|
);
|
||||||
|
$("#flyarea").append(e);
|
||||||
|
var o = $("#player").position().top + $("#player").width(),
|
||||||
|
t = $("#flyarea").height(),
|
||||||
|
s = Math.max(0, t - o);
|
||||||
|
$("#player").transition({ y: s + "px", rotate: 90 }, 1e3, "easeInOutCubic"),
|
||||||
|
(currentstate = states.ScoreScreen),
|
||||||
|
clearInterval(loopGameloop),
|
||||||
|
clearInterval(loopPipeloop),
|
||||||
|
(loopGameloop = null),
|
||||||
|
(loopPipeloop = null),
|
||||||
|
isIncompatible.any()
|
||||||
|
? (soundHit.play(), showScore())
|
||||||
|
: soundHit.play().bindOnce("ended", function () {
|
||||||
|
soundDie.play().bindOnce("ended", function () {
|
||||||
|
showScore();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function showScore() {
|
||||||
|
soundNasheed.stop(),
|
||||||
|
$("#scoreboard").css("display", "block"),
|
||||||
|
setBigScore(!0),
|
||||||
|
score > highscore &&
|
||||||
|
((highscore = score), setCookie("highscore", highscore, 999)),
|
||||||
|
setSmallScore(),
|
||||||
|
setHighScore();
|
||||||
|
var e = setMedal();
|
||||||
|
soundSwoosh.stop(),
|
||||||
|
soundSwoosh.play(),
|
||||||
|
$("#scoreboard").css({ y: "40px", opacity: 0 }),
|
||||||
|
$("#replay").css({ y: "40px", opacity: 0 }),
|
||||||
|
$("#scoreboard").transition(
|
||||||
|
{ y: "0px", opacity: 1 },
|
||||||
|
600,
|
||||||
|
"ease",
|
||||||
|
function () {
|
||||||
|
soundSwoosh.stop(),
|
||||||
|
soundSwoosh.play(),
|
||||||
|
$("#replay").transition({ y: "0px", opacity: 1 }, 600, "ease"),
|
||||||
|
e &&
|
||||||
|
($("#medal").css({ scale: 2, opacity: 0 }),
|
||||||
|
$("#medal").transition({ opacity: 1, scale: 1 }, 1200, "ease"));
|
||||||
|
}
|
||||||
|
),
|
||||||
|
(replayclickable = !0);
|
||||||
|
}
|
||||||
|
function playerScore() {
|
||||||
|
(score += 1), soundScore.stop(), soundScore.play(), setBigScore();
|
||||||
|
}
|
||||||
|
function updatePipes() {
|
||||||
|
$(".pipe")
|
||||||
|
.filter(function () {
|
||||||
|
return $(this).position().left <= -100;
|
||||||
|
})
|
||||||
|
.remove();
|
||||||
|
var e = 80,
|
||||||
|
o = 420 - pipeheight - 2 * e,
|
||||||
|
t = Math.floor(Math.random() * o + e),
|
||||||
|
s = 420 - pipeheight - t,
|
||||||
|
a = $(
|
||||||
|
'<div class="pipe animated"><div class="pipe_upper" style="height: ' +
|
||||||
|
t +
|
||||||
|
'px;"></div><div class="pipe_lower" style="height: ' +
|
||||||
|
s +
|
||||||
|
'px;"></div></div>'
|
||||||
|
);
|
||||||
|
$("#flyarea").append(a), pipes.push(a);
|
||||||
|
}
|
||||||
|
var debugmode = !1,
|
||||||
|
states = Object.freeze({ SplashScreen: 0, GameScreen: 1, ScoreScreen: 2 }),
|
||||||
|
currentstate,
|
||||||
|
gravity = 0.25,
|
||||||
|
velocity = 0,
|
||||||
|
position = 180,
|
||||||
|
rotation = 0,
|
||||||
|
jump = -4.6,
|
||||||
|
score = 0,
|
||||||
|
highscore = 0,
|
||||||
|
pipeheight = 100,
|
||||||
|
pipewidth = 52,
|
||||||
|
pipes = new Array(),
|
||||||
|
replayclickable = !1;
|
||||||
|
(buzz.defaults.preload = !0), (buzz.defaults.formats = ["ogg"]);
|
||||||
|
var volume = 30,
|
||||||
|
soundJump = new buzz.sound("assets/sounds/sfx_wing"),
|
||||||
|
soundScore = new buzz.sound("assets/sounds/sfx_point"),
|
||||||
|
soundDie = new buzz.sound("assets/sounds/sfx_die"),
|
||||||
|
soundSwoosh = new buzz.sound("assets/sounds/sfx_swooshing"),
|
||||||
|
soundNasheed = new buzz.sound("assets/sounds/nasheed"),
|
||||||
|
soundHit = new buzz.sound("assets/sounds/sfx_hit");
|
||||||
|
buzz.all().setVolume(volume), soundNasheed.setVolume(15);
|
||||||
|
var loopGameloop, loopPipeloop;
|
||||||
|
$(document).ready(function () {
|
||||||
|
"?debug" == window.location.search && (debugmode = !0),
|
||||||
|
"?easy" == window.location.search && (pipeheight = 200);
|
||||||
|
var e = getCookie("highscore");
|
||||||
|
"" != e && (highscore = parseInt(e)), showSplash();
|
||||||
|
}),
|
||||||
|
$(document).keydown(function (e) {
|
||||||
|
32 == e.keyCode &&
|
||||||
|
(currentstate == states.ScoreScreen
|
||||||
|
? $("#replay").click()
|
||||||
|
: screenClick());
|
||||||
|
}),
|
||||||
|
"ontouchstart" in window
|
||||||
|
? $(document).on("touchstart", screenClick)
|
||||||
|
: $(document).on("mousedown", screenClick),
|
||||||
|
$("#replay").click(function () {
|
||||||
|
$("#explosion").remove(),
|
||||||
|
replayclickable &&
|
||||||
|
((replayclickable = !1),
|
||||||
|
soundSwoosh.stop(),
|
||||||
|
soundSwoosh.play(),
|
||||||
|
$("#scoreboard").transition(
|
||||||
|
{ y: "-40px", opacity: 0 },
|
||||||
|
1e3,
|
||||||
|
"ease",
|
||||||
|
function () {
|
||||||
|
$("#scoreboard").css("display", "none"), showSplash();
|
||||||
|
}
|
||||||
|
));
|
||||||
|
});
|
||||||
|
var isIncompatible = {
|
||||||
|
Android: function () {
|
||||||
|
return navigator.userAgent.match(/Android/i);
|
||||||
|
},
|
||||||
|
BlackBerry: function () {
|
||||||
|
return navigator.userAgent.match(/BlackBerry/i);
|
||||||
|
},
|
||||||
|
iOS: function () {
|
||||||
|
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
|
||||||
|
},
|
||||||
|
Opera: function () {
|
||||||
|
return navigator.userAgent.match(/Opera Mini/i);
|
||||||
|
},
|
||||||
|
Safari: function () {
|
||||||
|
return (
|
||||||
|
navigator.userAgent.match(/OS X.*Safari/) &&
|
||||||
|
!navigator.userAgent.match(/Chrome/)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
Windows: function () {
|
||||||
|
return navigator.userAgent.match(/IEMobile/i);
|
||||||
|
},
|
||||||
|
any: function () {
|
||||||
|
return (
|
||||||
|
isIncompatible.Android() ||
|
||||||
|
isIncompatible.BlackBerry() ||
|
||||||
|
isIncompatible.iOS() ||
|
||||||
|
isIncompatible.Opera() ||
|
||||||
|
isIncompatible.Safari() ||
|
||||||
|
isIncompatible.Windows()
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|