Update memory-manager-concurrent
1
games/clumsyBird/build/clumsy-min.js
vendored
Normal file
1
games/clumsyBird/data/bgm/.placeholder
Normal file
@@ -0,0 +1 @@
|
||||
docs will be placed here when built
|
||||
BIN
games/clumsyBird/data/bgm/theme.mp3
Normal file
BIN
games/clumsyBird/data/bgm/theme.ogg
Normal file
BIN
games/clumsyBird/data/css/gamefont.eot
Normal file
130
games/clumsyBird/data/css/gamefont.svg
Normal file
@@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata></metadata>
|
||||
<defs>
|
||||
<font id="04b_19regular" horiz-adv-x="1170" >
|
||||
<font-face units-per-em="2048" ascent="1755" descent="-293" />
|
||||
<missing-glyph horiz-adv-x="877" />
|
||||
<glyph horiz-adv-x="2048" />
|
||||
<glyph horiz-adv-x="2048" />
|
||||
<glyph unicode="
" horiz-adv-x="877" />
|
||||
<glyph unicode=" " horiz-adv-x="877" />
|
||||
<glyph unicode="	" horiz-adv-x="877" />
|
||||
<glyph unicode=" " horiz-adv-x="877" />
|
||||
<glyph unicode="!" horiz-adv-x="585" d="M0 0h439v439h-439v-439zM0 585h439v1024h-439v-1024z" />
|
||||
<glyph unicode=""" d="M0 1024h439v585h-439v-585zM585 1024h439v585h-439v-585z" />
|
||||
<glyph unicode="#" horiz-adv-x="1755" d="M0 293h293v-293h438v293h147v-293h439v293h292v438h-292v147h292v439h-292v292h-439v-292h-147v292h-438v-292h-293v-439h293v-147h-293v-438zM731 731v147h147v-147h-147z" />
|
||||
<glyph unicode="$" horiz-adv-x="1755" d="M0 0h585v-146h439v146h585v1024h-585v146h585v439h-585v146h-439v-146h-585v-1024h585v-146h-585v-439zM439 1024v146h146v-146h-146zM1024 439v146h146v-146h-146z" />
|
||||
<glyph unicode="%" d="M0 0h439v585h439v146h146v878h-439v-585h-439v-146h-146v-878zM0 1170h439v439h-439v-439zM585 0h439v439h-439v-439z" />
|
||||
<glyph unicode="&" horiz-adv-x="1609" d="M0 0h1024v146h146v147h147v146h146v439h-439v-147h-146v147h146v731h-1024v-731h146v-147h-146v-731zM439 439v146h146v-146h-146zM439 1024v146h146v-146h-146z" />
|
||||
<glyph unicode="'" horiz-adv-x="585" d="M0 1024h439v585h-439v-585z" />
|
||||
<glyph unicode="(" horiz-adv-x="877" d="M0 439v731h146v147h147v146h146v146h292v-439h-146v-146h-146v-439h146v-146h146v-439h-292v146h-146v147h-147v146h-146z" />
|
||||
<glyph unicode=")" horiz-adv-x="877" d="M0 0v439h146v146h147v439h-147v146h-146v439h293v-146h146v-146h146v-147h146v-731h-146v-146h-146v-147h-146v-146h-293z" />
|
||||
<glyph unicode="*" horiz-adv-x="1755" d="M0 146h439v293h146v-439h439v439h146v-293h439v585h-146v147h146v585h-439v-293h-146v439h-439v-439h-146v293h-439v-585h146v-147h-146v-585z" />
|
||||
<glyph unicode="+" horiz-adv-x="1462" d="M0 585h439v-439h439v439h439v439h-439v439h-439v-439h-439v-439z" />
|
||||
<glyph unicode="," horiz-adv-x="585" d="M0 -293h439v732h-439v-732z" />
|
||||
<glyph unicode="-" d="M0 585h1024v439h-1024v-439z" />
|
||||
<glyph unicode="." horiz-adv-x="585" d="M0 0h439v439h-439v-439z" />
|
||||
<glyph unicode="/" horiz-adv-x="1024" d="M0 -146h439v439h146v438h146v439h147v439h-439v-439h-146v-439h-147v-438h-146v-439z" />
|
||||
<glyph unicode="0" d="M0 0h1024v1609h-1024v-1609zM439 439v731h146v-731h-146z" />
|
||||
<glyph unicode="1" horiz-adv-x="731" d="M0 1170h146v-1170h439v1609h-585v-439z" />
|
||||
<glyph unicode="2" d="M0 0h1024v439h-585v146h585v1024h-1024v-439h585v-146h-585v-1024z" />
|
||||
<glyph unicode="3" d="M0 0h1024v1609h-1024v-439h585v-146h-585v-439h585v-146h-585v-439z" />
|
||||
<glyph unicode="4" d="M0 293h585v-293h439v1609h-439v-878h-146v878h-439v-1316z" />
|
||||
<glyph unicode="5" d="M0 0h1024v1024h-585v146h585v439h-1024v-1024h585v-146h-585v-439z" />
|
||||
<glyph unicode="6" d="M0 0h1024v1024h-585v146h585v439h-1024v-1609zM439 439v146h146v-146h-146z" />
|
||||
<glyph unicode="7" d="M0 731h439v439h146v-1170h439v1609h-1024v-878z" />
|
||||
<glyph unicode="8" d="M0 0h1024v1609h-1024v-1609zM439 439v146h146v-146h-146zM439 1024v146h146v-146h-146z" />
|
||||
<glyph unicode="9" d="M0 0h1024v1609h-1024v-1024h585v-146h-585v-439zM439 1024v146h146v-146h-146z" />
|
||||
<glyph unicode=":" horiz-adv-x="585" d="M0 293h439v438h-439v-438zM0 878h439v439h-439v-439z" />
|
||||
<glyph unicode=";" horiz-adv-x="585" d="M0 0h439v731h-439v-731zM0 878h439v439h-439v-439z" />
|
||||
<glyph unicode="<" d="M0 585h146v-146h147v-146h146v-147h146v-146h439v293h-146v146h-147v146h-146v146h-146v147h146v146h146v146h147v147h146v292h-439v-146h-146v-146h-146v-147h-147v-146h-146v-439z" />
|
||||
<glyph unicode="=" d="M0 293h1024v438h-1024v-438zM0 878h1024v439h-1024v-439z" />
|
||||
<glyph unicode=">" d="M0 0h439v146h146v147h146v146h147v146h146v439h-146v146h-147v147h-146v146h-146v146h-439v-292h146v-147h147v-146h146v-146h146v-147h-146v-146h-146v-146h-147v-146h-146v-293z" />
|
||||
<glyph unicode="?" d="M0 1170h585v-146h-292v-439h731v1024h-1024v-439zM293 0h438v439h-438v-439z" />
|
||||
<glyph unicode="@" horiz-adv-x="1755" d="M0 0h1609v1609h-1609v-1609zM439 439v731h731v-146h-585v-585h-146zM1024 439v146h146v-146h-146z" />
|
||||
<glyph unicode="A" d="M0 0h439v585h146v-585h439v1609h-1024v-1609zM439 1024v146h146v-146h-146z" />
|
||||
<glyph unicode="B" d="M0 0h1024v731h-146v147h146v731h-1024v-1609zM439 439v146h146v-146h-146zM439 1024v146h146v-146h-146z" />
|
||||
<glyph unicode="C" d="M0 0h1024v731h-439v-292h-146v731h146v-292h439v731h-1024v-1609z" />
|
||||
<glyph unicode="D" d="M0 0h878v146h146v1317h-146v146h-878v-1609zM439 439v731h146v-731h-146z" />
|
||||
<glyph unicode="E" d="M0 0h1024v439h-585v146h585v439h-585v146h585v439h-1024v-1609z" />
|
||||
<glyph unicode="F" d="M0 0h439v585h585v439h-585v146h585v439h-1024v-1609z" />
|
||||
<glyph unicode="G" d="M0 0h1024v1024h-439v-585h-146v731h585v439h-1024v-1609z" />
|
||||
<glyph unicode="H" d="M0 0h439v585h146v-585h439v1609h-439v-585h-146v585h-439v-1609z" />
|
||||
<glyph unicode="I" horiz-adv-x="585" d="M0 0h439v1609h-439v-1609z" />
|
||||
<glyph unicode="J" d="M0 0h1024v1609h-439v-1170h-146v585h-439v-1024z" />
|
||||
<glyph unicode="K" d="M0 0h439v439h146v-439h439v731h-146v147h146v731h-439v-439h-146v439h-439v-1609z" />
|
||||
<glyph unicode="L" horiz-adv-x="877" d="M0 0h731v439h-292v1170h-439v-1609z" />
|
||||
<glyph unicode="M" horiz-adv-x="1755" d="M0 0h439v1170h146v-1170h439v1170h146v-1170h439v1609h-1609v-1609z" />
|
||||
<glyph unicode="N" d="M0 0h439v1170h146v-1170h439v1609h-1024v-1609z" />
|
||||
<glyph unicode="O" d="M0 0h1024v1609h-1024v-1609zM439 439v731h146v-731h-146z" />
|
||||
<glyph unicode="P" d="M0 0h439v293h585v1316h-1024v-1609zM439 731v439h146v-439h-146z" />
|
||||
<glyph unicode="Q" d="M0 0h293v-146h438v146h293v1609h-1024v-1609zM439 439v731h146v-731h-146z" />
|
||||
<glyph unicode="R" d="M0 0h439v146h146v-146h439v439h-146v146h146v1024h-1024v-1609zM439 731v439h146v-439h-146z" />
|
||||
<glyph unicode="S" d="M0 0h1024v1024h-585v146h585v439h-1024v-1024h585v-146h-585v-439z" />
|
||||
<glyph unicode="T" d="M0 1170h293v-1170h438v1170h293v439h-1024v-439z" />
|
||||
<glyph unicode="U" d="M0 0h1024v1609h-439v-1170h-146v1170h-439v-1609z" />
|
||||
<glyph unicode="V" d="M0 146h146v-146h732v146h146v1463h-439v-1170h-146v1170h-439v-1463z" />
|
||||
<glyph unicode="W" horiz-adv-x="1755" d="M0 0h1609v1609h-439v-1170h-146v1170h-439v-1170h-146v1170h-439v-1609z" />
|
||||
<glyph unicode="X" d="M0 0h439v439h146v-439h439v731h-146v147h146v731h-439v-439h-146v439h-439v-731h146v-147h-146v-731z" />
|
||||
<glyph unicode="Y" d="M0 585h293v-585h438v585h293v1024h-439v-585h-146v585h-439v-1024z" />
|
||||
<glyph unicode="Z" d="M0 0h1024v439h-585v146h585v1024h-1024v-439h585v-146h-585v-1024z" />
|
||||
<glyph unicode="[" horiz-adv-x="731" d="M0 0h585v439h-146v731h146v439h-585v-1609z" />
|
||||
<glyph unicode="\" horiz-adv-x="1024" d="M0 1170v439h439v-439h146v-439h146v-438h147v-439h-439v439h-146v438h-147v439h-146z" />
|
||||
<glyph unicode="]" horiz-adv-x="731" d="M0 0h585v1609h-585v-439h146v-731h-146v-439z" />
|
||||
<glyph unicode="^" d="M0 1024h293v146h146v147h146v-147h146v-146h293v293h-146v146h-147v146h-438v-146h-147v-146h-146v-293z" />
|
||||
<glyph unicode="_" d="M0 0h1024v439h-1024v-439z" />
|
||||
<glyph unicode="`" horiz-adv-x="877" d="M0 1170h731v439h-731v-439z" />
|
||||
<glyph unicode="a" d="M0 0h1024v1609h-878v-439h439v-146h-585v-1024zM439 439v146h146v-146h-146z" />
|
||||
<glyph unicode="b" d="M0 0h1024v1317h-585v292h-439v-1609zM439 439v439h146v-439h-146z" />
|
||||
<glyph unicode="c" d="M0 0h1024v731h-439v-292h-146v585h146v-146h439v585h-1024v-1463z" />
|
||||
<glyph unicode="d" d="M0 0h1024v1609h-439v-292h-585v-1317zM439 439v439h146v-439h-146z" />
|
||||
<glyph unicode="e" d="M0 0h1024v439h-585v146h585v1024h-1024v-1609zM439 1024v146h146v-146h-146z" />
|
||||
<glyph unicode="f" d="M0 0h878v585h146v439h-439v146h439v439h-878v-585h-146v-439h439v-146h-439v-439z" />
|
||||
<glyph unicode="g" d="M0 146v-439h1024v1610h-1024v-1024h585v-147h-585zM439 731v147h146v-147h-146z" />
|
||||
<glyph unicode="h" d="M0 0h439v878h146v-878h439v1317h-585v292h-439v-1609z" />
|
||||
<glyph unicode="i" horiz-adv-x="585" d="M0 0h439v1024h-439v-1024zM0 1170h439v439h-439v-439z" />
|
||||
<glyph unicode="j" d="M0 0h1024v1024h-439v-585h-146v585h-439v-1024zM585 1170h439v439h-439v-439z" />
|
||||
<glyph unicode="k" d="M0 0h439v293h146v-293h439v585h-146v146h146v586h-439v-293h-146v585h-439v-1609z" />
|
||||
<glyph unicode="l" horiz-adv-x="585" d="M0 0h439v1609h-439v-1609z" />
|
||||
<glyph unicode="m" horiz-adv-x="1755" d="M0 0h439v1024h146v-1024h439v1024h146v-1024h439v1463h-1609v-1463z" />
|
||||
<glyph unicode="n" d="M0 0h439v1024h146v-1024h439v1463h-1024v-1463z" />
|
||||
<glyph unicode="o" d="M0 0h1024v1463h-1024v-1463zM439 439v585h146v-585h-146z" />
|
||||
<glyph unicode="p" d="M0 -293h439v293h585v1317h-1024v-1610zM439 439v439h146v-439h-146z" />
|
||||
<glyph unicode="q" d="M0 0h585v-293h439v1610h-1024v-1317zM439 439v439h146v-439h-146z" />
|
||||
<glyph unicode="r" d="M0 0h439v1024h146v-293h439v732h-1024v-1463z" />
|
||||
<glyph unicode="s" d="M0 0h1024v1024h-585v146h585v439h-1024v-1024h585v-146h-585v-439z" />
|
||||
<glyph unicode="t" d="M0 0h1024v731h-439v-292h-146v439h585v439h-585v292h-439v-1609z" />
|
||||
<glyph unicode="u" d="M0 0h1024v1463h-439v-1024h-146v1024h-439v-1463z" />
|
||||
<glyph unicode="v" d="M0 146h146v-146h732v146h146v1317h-439v-1024h-146v1024h-439v-1317z" />
|
||||
<glyph unicode="w" horiz-adv-x="1755" d="M0 0h1609v1463h-439v-1024h-146v1024h-439v-1024h-146v1024h-439v-1463z" />
|
||||
<glyph unicode="x" d="M0 0h439v439h146v-439h439v731h-146v147h146v731h-439v-439h-146v439h-439v-731h146v-147h-146v-731z" />
|
||||
<glyph unicode="y" d="M0 146v-439h1024v1610h-439v-586h-146v586h-439v-1024h585v-147h-585z" />
|
||||
<glyph unicode="z" d="M0 0h1024v439h-585v146h585v1024h-1024v-439h585v-146h-585v-1024z" />
|
||||
<glyph unicode="{" horiz-adv-x="877" d="M0 585h146v-585h585v439h-146v731h146v439h-585v-585h-146v-439z" />
|
||||
<glyph unicode="|" horiz-adv-x="585" d="M0 0h439v1609h-439v-1609z" />
|
||||
<glyph unicode="}" horiz-adv-x="877" d="M0 0h585v585h146v439h-146v585h-585v-439h146v-731h-146v-439z" />
|
||||
<glyph unicode="~" horiz-adv-x="877" d="M0 1170h731v439h-731v-439z" />
|
||||
<glyph unicode="­" d="M0 585h1024v439h-1024v-439z" />
|
||||
<glyph unicode=" " horiz-adv-x="877" />
|
||||
<glyph unicode=" " horiz-adv-x="1755" />
|
||||
<glyph unicode=" " horiz-adv-x="877" />
|
||||
<glyph unicode=" " horiz-adv-x="1755" />
|
||||
<glyph unicode=" " horiz-adv-x="585" />
|
||||
<glyph unicode=" " horiz-adv-x="438" />
|
||||
<glyph unicode=" " horiz-adv-x="292" />
|
||||
<glyph unicode=" " horiz-adv-x="292" />
|
||||
<glyph unicode=" " horiz-adv-x="219" />
|
||||
<glyph unicode=" " horiz-adv-x="351" />
|
||||
<glyph unicode=" " horiz-adv-x="97" />
|
||||
<glyph unicode="‐" d="M0 585h1024v439h-1024v-439z" />
|
||||
<glyph unicode="‑" d="M0 585h1024v439h-1024v-439z" />
|
||||
<glyph unicode="‒" d="M0 585h1024v439h-1024v-439z" />
|
||||
<glyph unicode="–" d="M0 585h1024v439h-1024v-439z" />
|
||||
<glyph unicode="—" horiz-adv-x="2194" d="M0 585h2048v439h-2048v-439z" />
|
||||
<glyph unicode=" " horiz-adv-x="351" />
|
||||
<glyph unicode=" " horiz-adv-x="438" />
|
||||
<glyph unicode="◼" horiz-adv-x="1609" d="M0 0v1609h1609v-1609h-1609z" />
|
||||
</font>
|
||||
</defs></svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
BIN
games/clumsyBird/data/css/gamefont.ttf
Normal file
BIN
games/clumsyBird/data/css/gamefont.woff
Normal file
1
games/clumsyBird/data/img/.placeholder
Normal file
@@ -0,0 +1 @@
|
||||
docs will be placed here when built
|
||||
BIN
games/clumsyBird/data/img/bg.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
games/clumsyBird/data/img/clumsy.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
games/clumsyBird/data/img/favicon.ico
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
games/clumsyBird/data/img/gameover.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
games/clumsyBird/data/img/gameoverbg.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
games/clumsyBird/data/img/getready.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
games/clumsyBird/data/img/ground.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
games/clumsyBird/data/img/hit.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
games/clumsyBird/data/img/logo.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
games/clumsyBird/data/img/new.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
games/clumsyBird/data/img/pipe.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
games/clumsyBird/data/img/share.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
games/clumsyBird/data/img/touch-icon-iphone-retina.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
games/clumsyBird/data/img/touch-icon-iphone.png
Normal file
|
After Width: | Height: | Size: 997 B |
BIN
games/clumsyBird/data/img/tweet.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
1
games/clumsyBird/data/sfx/.placeholder
Normal file
@@ -0,0 +1 @@
|
||||
docs will be placed here when built
|
||||
BIN
games/clumsyBird/data/sfx/hit.mp3
Normal file
BIN
games/clumsyBird/data/sfx/hit.ogg
Normal file
BIN
games/clumsyBird/data/sfx/lose.mp3
Normal file
BIN
games/clumsyBird/data/sfx/lose.ogg
Normal file
BIN
games/clumsyBird/data/sfx/wing.mp3
Normal file
BIN
games/clumsyBird/data/sfx/wing.ogg
Normal file
BIN
games/clumsyBird/data/sfx/wing.wav
Normal file
57
games/clumsyBird/index.css
Normal file
@@ -0,0 +1,57 @@
|
||||
body {
|
||||
background-color: #0099cc;
|
||||
color: #fff;
|
||||
|
||||
/* Allow mouse dragging. */
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
-o-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
/* disable touch panning/zooming */
|
||||
-ms-touch-action: none;
|
||||
touch-action: none;
|
||||
|
||||
/* Allow canvas to hit the edges of the browser viewport. */
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#screen canvas {
|
||||
margin: auto;
|
||||
/* Hide the gap for font descenders. */
|
||||
display: block;
|
||||
|
||||
/* disable scaling interpolation */
|
||||
image-rendering: optimizeSpeed;
|
||||
image-rendering: -moz-crisp-edges;
|
||||
image-rendering: -o-crisp-edges;
|
||||
image-rendering: -webkit-optimize-contrast;
|
||||
image-rendering: optimize-contrast;
|
||||
-ms-interpolation-mode: nearest-neighbor;
|
||||
}
|
||||
|
||||
#share {
|
||||
margin: 10px auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#share .fb-share-button iframe {
|
||||
margin-top: -4px;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'gamefont';
|
||||
src: url('data/css/gamefont.eot');
|
||||
src: url('data/css/gamefont.eot?#iefix') format('embedded-opentype'),
|
||||
url('data/css/gamefont.woff') format('woff'),
|
||||
url('data/css/gamefont.ttf') format('truetype'),
|
||||
url('data/css/gamefont.svg#gamefont') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.google {
|
||||
position: absolute;
|
||||
left:23%;
|
||||
}
|
||||
49
games/clumsyBird/index.html
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Clumsy Bird</title>
|
||||
<link rel="apple-touch-icon-precomposed" href="data/img/touch-icon-iphone.png"/>
|
||||
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="data/img/touch-icon-iphone-retina.png"/>
|
||||
<link rel="shortcut icon" href="data/img/favicon.ico">
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="index.css">
|
||||
<meta id="viewport" name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-title" content="Clumsy Bird">
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="description" content="Clumsy Bird - A Flappy Bird clone using MelonJS"/>
|
||||
<meta name="keywords" content="flappybird, flappy, bird, game, html5, melonjs,clone"/>
|
||||
<meta name="robots" content="index, follow">
|
||||
<meta name="google-site-verification" content="RDZI9SqVaffd48uHfZMv67-YdvviOMe2HuULEYqVgd4" />
|
||||
<meta property="og:image" content="http://ellisonleao.github.io/clumsy-bird/data/img/bg.png" />
|
||||
<meta property="og:title" content="Clumsy Bird - A Flappy Bird clone using MelonJS"/>
|
||||
<meta property="og:url" content="http://ellisonleao.github.io/clumsy-bird/"/>
|
||||
<meta property="og:site_name" content="Clumsy Bird - MelonJS"/>
|
||||
|
||||
<!-- Twitter Card -->
|
||||
<meta name="twitter:hashtag" content="clumsybird" />
|
||||
<meta name="twitter:card" content="summary" />
|
||||
<meta name="twitter:site" content="@ellisonleao" />
|
||||
<meta name="twitter:creator" content="@ellisonleao" />
|
||||
<meta name="twitter:title" content="Clumsy Bird" />
|
||||
<meta name="twitter:description" content="A Flappy Bird melonJS clone" />
|
||||
|
||||
<!-- Humans -->
|
||||
<link rel="author" href="humans.txt" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Canvas placeholder -->
|
||||
<div id="screen"></div>
|
||||
|
||||
<!-- melonJS Library -->
|
||||
<script type="text/javascript" src="js/melonJS-min.js" ></script>
|
||||
<script type="text/javascript" src="build/clumsy-min.js" ></script>
|
||||
<script type="text/javascript">
|
||||
window.onReady(function onReady() {
|
||||
game.onload();
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
66
games/clumsyBird/js/entities/HUD.js
Normal file
@@ -0,0 +1,66 @@
|
||||
game.HUD = game.HUD || {};
|
||||
|
||||
game.HUD.Container = me.Container.extend({
|
||||
init: function() {
|
||||
this._super(me.Container, 'init');
|
||||
// persistent across level change
|
||||
this.isPersistent = true;
|
||||
|
||||
// non collidable
|
||||
this.collidable = false;
|
||||
|
||||
// make sure our object is always draw first
|
||||
this.z = Infinity;
|
||||
|
||||
// give a name
|
||||
this.name = "HUD";
|
||||
|
||||
// add our child score object at the top left corner
|
||||
this.addChild(new game.HUD.ScoreItem(5, 5));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
game.HUD.ScoreItem = me.Renderable.extend({
|
||||
init: function(x, y) {
|
||||
this._super(me.Renderable, "init", [x, y, 10, 10]);
|
||||
|
||||
// local copy of the global score
|
||||
this.stepsFont = new me.Font('gamefont', 80, '#000', 'center');
|
||||
|
||||
// make sure we use screen coordinates
|
||||
this.floating = true;
|
||||
},
|
||||
|
||||
draw: function (renderer) {
|
||||
if (game.data.start && me.state.isCurrent(me.state.PLAY))
|
||||
this.stepsFont.draw(renderer, game.data.steps, me.game.viewport.width/2, 10);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var BackgroundLayer = me.ImageLayer.extend({
|
||||
init: function(image, z, speed) {
|
||||
var settings = {};
|
||||
settings.name = image;
|
||||
settings.width = 900;
|
||||
settings.height = 600;
|
||||
settings.image = image;
|
||||
settings.z = z;
|
||||
settings.ratio = 1;
|
||||
// call parent constructor
|
||||
this._super(me.ImageLayer, 'init', [0, 0, settings]);
|
||||
},
|
||||
|
||||
update: function() {
|
||||
if (me.input.isKeyPressed('mute')) {
|
||||
game.data.muted = !game.data.muted;
|
||||
if (game.data.muted){
|
||||
me.audio.disable();
|
||||
}else{
|
||||
me.audio.enable();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
239
games/clumsyBird/js/entities/entities.js
Normal file
@@ -0,0 +1,239 @@
|
||||
game.BirdEntity = me.Entity.extend({
|
||||
init: function(x, y) {
|
||||
var settings = {};
|
||||
settings.image = 'clumsy';
|
||||
settings.width = 85;
|
||||
settings.height = 60;
|
||||
|
||||
this._super(me.Entity, 'init', [x, y, settings]);
|
||||
this.alwaysUpdate = true;
|
||||
this.body.gravity = 0.2;
|
||||
this.maxAngleRotation = Number.prototype.degToRad(-30);
|
||||
this.maxAngleRotationDown = Number.prototype.degToRad(35);
|
||||
this.renderable.addAnimation("flying", [0, 1, 2]);
|
||||
this.renderable.addAnimation("idle", [0]);
|
||||
this.renderable.setCurrentAnimation("flying");
|
||||
//this.renderable.anchorPoint = new me.Vector2d(0.1, 0.5);
|
||||
this.body.removeShapeAt(0);
|
||||
this.body.addShape(new me.Ellipse(5, 5, 71, 51));
|
||||
|
||||
// a tween object for the flying physic effect
|
||||
this.flyTween = new me.Tween(this.pos);
|
||||
this.flyTween.easing(me.Tween.Easing.Exponential.InOut);
|
||||
|
||||
this.currentAngle = 0;
|
||||
this.angleTween = new me.Tween(this);
|
||||
this.angleTween.easing(me.Tween.Easing.Exponential.InOut);
|
||||
|
||||
// end animation tween
|
||||
this.endTween = null;
|
||||
|
||||
// collision shape
|
||||
this.collided = false;
|
||||
|
||||
this.gravityForce = 0.2;
|
||||
},
|
||||
|
||||
update: function(dt) {
|
||||
var that = this;
|
||||
this.pos.x = 60;
|
||||
if (!game.data.start) {
|
||||
return this._super(me.Entity, 'update', [dt]);
|
||||
}
|
||||
this.renderable.currentTransform.identity();
|
||||
if (me.input.isKeyPressed('fly')) {
|
||||
me.audio.play('wing');
|
||||
this.gravityForce = 0.2;
|
||||
var currentPos = this.pos.y;
|
||||
|
||||
this.angleTween.stop();
|
||||
this.flyTween.stop();
|
||||
|
||||
|
||||
this.flyTween.to({y: currentPos - 72}, 50);
|
||||
this.flyTween.start();
|
||||
|
||||
this.angleTween.to({currentAngle: that.maxAngleRotation}, 50).onComplete(function(angle) {
|
||||
that.renderable.currentTransform.rotate(that.maxAngleRotation);
|
||||
})
|
||||
this.angleTween.start();
|
||||
|
||||
} else {
|
||||
this.gravityForce += 0.2;
|
||||
this.pos.y += me.timer.tick * this.gravityForce;
|
||||
this.currentAngle += Number.prototype.degToRad(3);
|
||||
if (this.currentAngle >= this.maxAngleRotationDown) {
|
||||
this.renderable.currentTransform.identity();
|
||||
this.currentAngle = this.maxAngleRotationDown;
|
||||
}
|
||||
}
|
||||
this.renderable.currentTransform.rotate(this.currentAngle);
|
||||
me.Rect.prototype.updateBounds.apply(this);
|
||||
|
||||
var hitSky = -80; // bird height + 20px
|
||||
if (this.pos.y <= hitSky || this.collided) {
|
||||
game.data.start = false;
|
||||
me.audio.play("lose");
|
||||
this.endAnimation();
|
||||
return false;
|
||||
}
|
||||
me.collision.check(this);
|
||||
return true;
|
||||
},
|
||||
|
||||
onCollision: function(response) {
|
||||
var obj = response.b;
|
||||
if (obj.type === 'pipe' || obj.type === 'ground') {
|
||||
me.device.vibrate(500);
|
||||
this.collided = true;
|
||||
}
|
||||
// remove the hit box
|
||||
if (obj.type === 'hit') {
|
||||
me.game.world.removeChildNow(obj);
|
||||
game.data.steps++;
|
||||
me.audio.play('hit');
|
||||
}
|
||||
},
|
||||
|
||||
endAnimation: function() {
|
||||
me.game.viewport.fadeOut("#fff", 100);
|
||||
var currentPos = this.pos.y;
|
||||
this.endTween = new me.Tween(this.pos);
|
||||
this.endTween.easing(me.Tween.Easing.Exponential.InOut);
|
||||
|
||||
this.flyTween.stop();
|
||||
this.renderable.currentTransform.identity();
|
||||
this.renderable.currentTransform.rotate(Number.prototype.degToRad(90));
|
||||
var finalPos = me.game.viewport.height - this.renderable.width/2 - 96;
|
||||
this.endTween
|
||||
.to({y: currentPos}, 1000)
|
||||
.to({y: finalPos}, 1000)
|
||||
.onComplete(function() {
|
||||
me.state.change(me.state.GAME_OVER);
|
||||
});
|
||||
this.endTween.start();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
game.PipeEntity = me.Entity.extend({
|
||||
init: function(x, y) {
|
||||
var settings = {};
|
||||
settings.image = this.image = me.loader.getImage('pipe');
|
||||
settings.width = 148;
|
||||
settings.height= 1664;
|
||||
settings.framewidth = 148;
|
||||
settings.frameheight = 1664;
|
||||
|
||||
this._super(me.Entity, 'init', [x, y, settings]);
|
||||
this.alwaysUpdate = true;
|
||||
this.body.gravity = 0;
|
||||
this.body.vel.set(-5, 0);
|
||||
this.type = 'pipe';
|
||||
},
|
||||
|
||||
update: function(dt) {
|
||||
// mechanics
|
||||
if (!game.data.start) {
|
||||
return this._super(me.Entity, 'update', [dt]);
|
||||
}
|
||||
this.pos.add(this.body.vel);
|
||||
if (this.pos.x < -this.image.width) {
|
||||
me.game.world.removeChild(this);
|
||||
}
|
||||
me.Rect.prototype.updateBounds.apply(this);
|
||||
this._super(me.Entity, 'update', [dt]);
|
||||
return true;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
game.PipeGenerator = me.Renderable.extend({
|
||||
init: function() {
|
||||
this._super(me.Renderable, 'init', [0, me.game.viewport.width, me.game.viewport.height, 92]);
|
||||
this.alwaysUpdate = true;
|
||||
this.generate = 0;
|
||||
this.pipeFrequency = 92;
|
||||
this.pipeHoleSize = 1240;
|
||||
this.posX = me.game.viewport.width;
|
||||
},
|
||||
|
||||
update: function(dt) {
|
||||
if (this.generate++ % this.pipeFrequency == 0) {
|
||||
var posY = Number.prototype.random(
|
||||
me.video.renderer.getHeight() - 100,
|
||||
200
|
||||
);
|
||||
var posY2 = posY - me.game.viewport.height - this.pipeHoleSize;
|
||||
var pipe1 = new me.pool.pull('pipe', this.posX, posY);
|
||||
var pipe2 = new me.pool.pull('pipe', this.posX, posY2);
|
||||
var hitPos = posY - 100;
|
||||
var hit = new me.pool.pull("hit", this.posX, hitPos);
|
||||
pipe1.renderable.currentTransform.scaleY(-1);
|
||||
me.game.world.addChild(pipe1, 10);
|
||||
me.game.world.addChild(pipe2, 10);
|
||||
me.game.world.addChild(hit, 11);
|
||||
}
|
||||
this._super(me.Entity, "update", [dt]);
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
game.HitEntity = me.Entity.extend({
|
||||
init: function(x, y) {
|
||||
var settings = {};
|
||||
settings.image = this.image = me.loader.getImage('hit');
|
||||
settings.width = 148;
|
||||
settings.height= 60;
|
||||
settings.framewidth = 148;
|
||||
settings.frameheight = 60;
|
||||
|
||||
this._super(me.Entity, 'init', [x, y, settings]);
|
||||
this.alwaysUpdate = true;
|
||||
this.body.gravity = 0;
|
||||
this.updateTime = false;
|
||||
this.renderable.alpha = 0;
|
||||
this.body.accel.set(-5, 0);
|
||||
this.body.removeShapeAt(0);
|
||||
this.body.addShape(new me.Rect(0, 0, settings.width - 30, settings.height - 30));
|
||||
this.type = 'hit';
|
||||
},
|
||||
|
||||
update: function(dt) {
|
||||
// mechanics
|
||||
this.pos.add(this.body.accel);
|
||||
if (this.pos.x < -this.image.width) {
|
||||
me.game.world.removeChild(this);
|
||||
}
|
||||
me.Rect.prototype.updateBounds.apply(this);
|
||||
this._super(me.Entity, "update", [dt]);
|
||||
return true;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
game.Ground = me.Entity.extend({
|
||||
init: function(x, y) {
|
||||
var settings = {};
|
||||
settings.image = me.loader.getImage('ground');
|
||||
settings.width = 900;
|
||||
settings.height= 96;
|
||||
this._super(me.Entity, 'init', [x, y, settings]);
|
||||
this.alwaysUpdate = true;
|
||||
this.body.gravity = 0;
|
||||
this.body.vel.set(-4, 0);
|
||||
this.type = 'ground';
|
||||
},
|
||||
|
||||
update: function(dt) {
|
||||
// mechanics
|
||||
this.pos.add(this.body.vel);
|
||||
if (this.pos.x < -this.renderable.width) {
|
||||
this.pos.x = me.video.renderer.getWidth() - 10;
|
||||
}
|
||||
me.Rect.prototype.updateBounds.apply(this);
|
||||
return this._super(me.Entity, 'update', [dt]);
|
||||
},
|
||||
|
||||
});
|
||||
61
games/clumsyBird/js/game.js
Normal file
@@ -0,0 +1,61 @@
|
||||
var game = {
|
||||
data: {
|
||||
score : 0,
|
||||
steps: 0,
|
||||
start: false,
|
||||
newHiScore: false,
|
||||
muted: false
|
||||
},
|
||||
|
||||
resources: [
|
||||
// images
|
||||
{name: "bg", type:"image", src: "data/img/bg.png"},
|
||||
{name: "clumsy", type:"image", src: "data/img/clumsy.png"},
|
||||
{name: "pipe", type:"image", src: "data/img/pipe.png"},
|
||||
{name: "logo", type:"image", src: "data/img/logo.png"},
|
||||
{name: "ground", type:"image", src: "data/img/ground.png"},
|
||||
{name: "gameover", type:"image", src: "data/img/gameover.png"},
|
||||
{name: "gameoverbg", type:"image", src: "data/img/gameoverbg.png"},
|
||||
{name: "hit", type:"image", src: "data/img/hit.png"},
|
||||
{name: "getready", type:"image", src: "data/img/getready.png"},
|
||||
{name: "new", type:"image", src: "data/img/new.png"},
|
||||
{name: "share", type:"image", src: "data/img/share.png"},
|
||||
{name: "tweet", type:"image", src: "data/img/tweet.png"},
|
||||
// sounds
|
||||
{name: "theme", type: "audio", src: "data/bgm/"},
|
||||
{name: "hit", type: "audio", src: "data/sfx/"},
|
||||
{name: "lose", type: "audio", src: "data/sfx/"},
|
||||
{name: "wing", type: "audio", src: "data/sfx/"},
|
||||
|
||||
],
|
||||
|
||||
"onload": function() {
|
||||
if (!me.video.init(900, 600, {
|
||||
wrapper: "screen",
|
||||
scale : "auto",
|
||||
scaleMethod: "fit"
|
||||
})) {
|
||||
alert("Your browser does not support HTML5 canvas.");
|
||||
return;
|
||||
}
|
||||
me.audio.init("mp3,ogg");
|
||||
me.loader.preload(game.resources, this.loaded.bind(this));
|
||||
},
|
||||
|
||||
"loaded": function() {
|
||||
me.state.set(me.state.MENU, new game.TitleScreen());
|
||||
me.state.set(me.state.PLAY, new game.PlayScreen());
|
||||
me.state.set(me.state.GAME_OVER, new game.GameOverScreen());
|
||||
|
||||
me.input.bindKey(me.input.KEY.SPACE, "fly", true);
|
||||
me.input.bindKey(me.input.KEY.M, "mute", true);
|
||||
me.input.bindPointer(me.input.KEY.SPACE);
|
||||
|
||||
me.pool.register("clumsy", game.BirdEntity);
|
||||
me.pool.register("pipe", game.PipeEntity, true);
|
||||
me.pool.register("hit", game.HitEntity, true);
|
||||
me.pool.register("ground", game.Ground, true);
|
||||
|
||||
me.state.change(me.state.MENU);
|
||||
}
|
||||
};
|
||||
40
games/clumsyBird/js/melonJS-min.js
vendored
Normal file
110
games/clumsyBird/js/screens/gameover.js
Normal file
@@ -0,0 +1,110 @@
|
||||
game.GameOverScreen = me.ScreenObject.extend({
|
||||
init: function() {
|
||||
this.savedData = null;
|
||||
this.handler = null;
|
||||
},
|
||||
|
||||
onResetEvent: function() {
|
||||
//save section
|
||||
this.savedData = {
|
||||
score: game.data.score,
|
||||
steps: game.data.steps
|
||||
};
|
||||
me.save.add(this.savedData);
|
||||
|
||||
if (!me.save.topSteps) me.save.add({topSteps: game.data.steps});
|
||||
if (game.data.steps > me.save.topSteps) {
|
||||
me.save.topSteps = game.data.steps;
|
||||
game.data.newHiScore = true;
|
||||
}
|
||||
me.input.bindKey(me.input.KEY.ENTER, "enter", true);
|
||||
me.input.bindKey(me.input.KEY.SPACE, "enter", false)
|
||||
me.input.bindPointer(me.input.pointer.LEFT, me.input.KEY.ENTER);
|
||||
|
||||
this.handler = me.event.subscribe(me.event.KEYDOWN,
|
||||
function (action, keyCode, edge) {
|
||||
if (action === "enter") {
|
||||
me.state.change(me.state.MENU);
|
||||
}
|
||||
});
|
||||
|
||||
me.game.world.addChild(new me.Sprite(
|
||||
me.game.viewport.width/2,
|
||||
me.game.viewport.height/2 - 100,
|
||||
{image: 'gameover'}
|
||||
), 12);
|
||||
|
||||
var gameOverBG = new me.Sprite(
|
||||
me.game.viewport.width/2,
|
||||
me.game.viewport.height/2,
|
||||
{image: 'gameoverbg'}
|
||||
);
|
||||
me.game.world.addChild(gameOverBG, 10);
|
||||
|
||||
me.game.world.addChild(new BackgroundLayer('bg', 1));
|
||||
|
||||
// ground
|
||||
this.ground1 = me.pool.pull('ground', 0, me.game.viewport.height - 96);
|
||||
this.ground2 = me.pool.pull('ground', me.game.viewport.width,
|
||||
me.video.renderer.getHeight() - 96);
|
||||
me.game.world.addChild(this.ground1, 11);
|
||||
me.game.world.addChild(this.ground2, 11);
|
||||
|
||||
// add the dialog witht he game information
|
||||
if (game.data.newHiScore) {
|
||||
var newRect = new me.Sprite(
|
||||
gameOverBG.width/2,
|
||||
gameOverBG.height/2,
|
||||
{image: 'new'}
|
||||
);
|
||||
me.game.world.addChild(newRect, 12);
|
||||
}
|
||||
|
||||
this.dialog = new (me.Renderable.extend({
|
||||
// constructor
|
||||
init: function() {
|
||||
this._super(me.Renderable, 'init',
|
||||
[0, 0, me.game.viewport.width/2, me.game.viewport.height/2]
|
||||
);
|
||||
this.font = new me.Font('gamefont', 40, 'black', 'left');
|
||||
this.steps = 'Steps: ' + game.data.steps.toString();
|
||||
this.topSteps= 'Higher Step: ' + me.save.topSteps.toString();
|
||||
},
|
||||
|
||||
draw: function (renderer) {
|
||||
var stepsText = this.font.measureText(renderer, this.steps);
|
||||
var topStepsText = this.font.measureText(renderer, this.topSteps);
|
||||
var scoreText = this.font.measureText(renderer, this.score);
|
||||
|
||||
//steps
|
||||
this.font.draw(
|
||||
renderer,
|
||||
this.steps,
|
||||
me.game.viewport.width/2 - stepsText.width/2 - 60,
|
||||
me.game.viewport.height/2
|
||||
);
|
||||
|
||||
//top score
|
||||
this.font.draw(
|
||||
renderer,
|
||||
this.topSteps,
|
||||
me.game.viewport.width/2 - stepsText.width/2 - 60,
|
||||
me.game.viewport.height/2 + 50
|
||||
);
|
||||
}
|
||||
}));
|
||||
me.game.world.addChild(this.dialog, 12);
|
||||
},
|
||||
|
||||
onDestroyEvent: function() {
|
||||
// unregister the event
|
||||
me.event.unsubscribe(this.handler);
|
||||
me.input.unbindKey(me.input.KEY.ENTER);
|
||||
me.input.unbindKey(me.input.KEY.SPACE);
|
||||
me.input.unbindPointer(me.input.pointer.LEFT);
|
||||
this.ground1 = null;
|
||||
this.ground2 = null;
|
||||
this.font = null;
|
||||
me.audio.stop("theme");
|
||||
}
|
||||
});
|
||||
67
games/clumsyBird/js/screens/play.js
Normal file
@@ -0,0 +1,67 @@
|
||||
game.PlayScreen = me.ScreenObject.extend({
|
||||
init: function() {
|
||||
me.audio.play("theme", true);
|
||||
// lower audio volume on firefox browser
|
||||
var vol = me.device.ua.indexOf("Firefox") !== -1 ? 0.3 : 0.5;
|
||||
me.audio.setVolume(vol);
|
||||
this._super(me.ScreenObject, 'init');
|
||||
},
|
||||
|
||||
onResetEvent: function() {
|
||||
me.game.reset();
|
||||
me.audio.stop("theme");
|
||||
if (!game.data.muted){
|
||||
me.audio.play("theme", true);
|
||||
}
|
||||
|
||||
me.input.bindKey(me.input.KEY.SPACE, "fly", true);
|
||||
game.data.score = 0;
|
||||
game.data.steps = 0;
|
||||
game.data.start = false;
|
||||
game.data.newHiscore = false;
|
||||
|
||||
me.game.world.addChild(new BackgroundLayer('bg', 1));
|
||||
|
||||
this.ground1 = me.pool.pull('ground', 0, me.game.viewport.height - 96);
|
||||
this.ground2 = me.pool.pull('ground', me.game.viewport.width,
|
||||
me.game.viewport.height - 96);
|
||||
me.game.world.addChild(this.ground1, 11);
|
||||
me.game.world.addChild(this.ground2, 11);
|
||||
|
||||
this.HUD = new game.HUD.Container();
|
||||
me.game.world.addChild(this.HUD, 11);
|
||||
|
||||
this.bird = me.pool.pull("clumsy", 60, me.game.viewport.height/2 - 100);
|
||||
me.game.world.addChild(this.bird, 10);
|
||||
|
||||
//inputs
|
||||
me.input.bindPointer(me.input.pointer.LEFT, me.input.KEY.SPACE);
|
||||
|
||||
this.getReady = new me.Sprite(
|
||||
me.game.viewport.width/2,
|
||||
me.game.viewport.height/2,
|
||||
{image: 'getready'}
|
||||
);
|
||||
me.game.world.addChild(this.getReady, 11);
|
||||
|
||||
var that = this;
|
||||
var fadeOut = new me.Tween(this.getReady).to({alpha: 0}, 2000)
|
||||
.easing(me.Tween.Easing.Linear.None)
|
||||
.onComplete(function() {
|
||||
game.data.start = true;
|
||||
me.game.world.addChild(new game.PipeGenerator(), 0);
|
||||
me.game.world.removeChild(that.getReady);
|
||||
}).start();
|
||||
},
|
||||
|
||||
onDestroyEvent: function() {
|
||||
me.audio.stopTrack('theme');
|
||||
// free the stored instance
|
||||
this.HUD = null;
|
||||
this.bird = null;
|
||||
this.ground1 = null;
|
||||
this.ground2 = null;
|
||||
me.input.unbindKey(me.input.KEY.SPACE);
|
||||
me.input.unbindPointer(me.input.pointer.LEFT);
|
||||
}
|
||||
});
|
||||
73
games/clumsyBird/js/screens/title.js
Normal file
@@ -0,0 +1,73 @@
|
||||
game.TitleScreen = me.ScreenObject.extend({
|
||||
init: function(){
|
||||
this._super(me.ScreenObject, 'init');
|
||||
this.font = null;
|
||||
this.ground1 = null;
|
||||
this.ground2 = null;
|
||||
this.logo = null;
|
||||
},
|
||||
|
||||
onResetEvent: function() {
|
||||
me.audio.stop("theme");
|
||||
game.data.newHiScore = false;
|
||||
|
||||
me.game.world.addChild(new BackgroundLayer('bg', 1));
|
||||
me.input.bindKey(me.input.KEY.ENTER, "enter", true);
|
||||
me.input.bindKey(me.input.KEY.SPACE, "enter", true);
|
||||
me.input.bindPointer(me.input.pointer.LEFT, me.input.KEY.ENTER);
|
||||
|
||||
this.handler = me.event.subscribe(me.event.KEYDOWN, function (action, keyCode, edge) {
|
||||
if (action === "enter") {
|
||||
me.state.change(me.state.PLAY);
|
||||
}
|
||||
});
|
||||
|
||||
//logo
|
||||
this.logo = new me.Sprite(
|
||||
me.game.viewport.width/2,
|
||||
me.game.viewport.height/2 - 20,
|
||||
{image: 'logo'}
|
||||
);
|
||||
me.game.world.addChild(this.logo, 10);
|
||||
|
||||
var that = this;
|
||||
var logoTween = me.pool.pull("me.Tween", this.logo.pos)
|
||||
.to({y: me.game.viewport.height/2 - 100}, 1000)
|
||||
.easing(me.Tween.Easing.Exponential.InOut).start();
|
||||
|
||||
this.ground1 = me.pool.pull("ground", 0, me.video.renderer.getHeight() - 96);
|
||||
this.ground2 = me.pool.pull("ground", me.video.renderer.getWidth(),
|
||||
me.video.renderer.getHeight() - 96);
|
||||
me.game.world.addChild(this.ground1, 11);
|
||||
me.game.world.addChild(this.ground2, 11);
|
||||
|
||||
me.game.world.addChild(new (me.Renderable.extend ({
|
||||
// constructor
|
||||
init: function() {
|
||||
// size does not matter, it's just to avoid having a zero size
|
||||
// renderable
|
||||
this._super(me.Renderable, 'init', [0, 0, 100, 100]);
|
||||
this.text = me.device.touch ? 'Tap to start' : 'PRESS SPACE OR CLICK LEFT MOUSE BUTTON TO START \n\t\t\t\t\t\t\t\t\t\t\tPRESS "M" TO MUTE SOUND';
|
||||
this.font = new me.Font('gamefont', 20, '#000');
|
||||
},
|
||||
draw: function (renderer) {
|
||||
var measure = this.font.measureText(renderer, this.text);
|
||||
var xpos = me.game.viewport.width/2 - measure.width/2;
|
||||
var ypos = me.game.viewport.height/2 + 50;
|
||||
this.font.draw(renderer, this.text, xpos, ypos);
|
||||
}
|
||||
})), 12);
|
||||
},
|
||||
|
||||
onDestroyEvent: function() {
|
||||
// unregister the event
|
||||
me.event.unsubscribe(this.handler);
|
||||
me.input.unbindKey(me.input.KEY.ENTER);
|
||||
me.input.unbindKey(me.input.KEY.SPACE);
|
||||
me.input.unbindPointer(me.input.pointer.LEFT);
|
||||
this.ground1 = null;
|
||||
this.ground2 = null;
|
||||
me.game.world.removeChild(this.logo);
|
||||
this.logo = null;
|
||||
}
|
||||
});
|
||||