-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathindex.min.html
95 lines (95 loc) · 29.3 KB
/
index.min.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
html,body{
height: 100%;
display: grid;
overflow: hidden;
background: #000;
}
#a{
border-radius: 10px;
margin: auto;
}
</style>
</head>
<body>
<canvas id=a></canvas>
</body>
<script>
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var b,d=[];!(b=a.next()).done;)d.push(b.value);return d};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var b=function(){};b.prototype=a;return new b};
$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,d){if(a==Array.prototype||a==Object.prototype)return a;a[b]=d.value;return a};$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var d=a[b];if(d&&d.Math==Math)return d}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);
$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,b){var d=$jscomp.propertyToPolyfillSymbol[b];if(null==d)return a[b];d=a[d];return void 0!==d?d:a[b]};
$jscomp.polyfill=function(a,b,d,f){b&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,b,d,f):$jscomp.polyfillUnisolated(a,b,d,f))};$jscomp.polyfillUnisolated=function(a,b,d,f){d=$jscomp.global;a=a.split(".");for(f=0;f<a.length-1;f++){var e=a[f];if(!(e in d))return;d=d[e]}a=a[a.length-1];f=d[a];b=b(f);b!=f&&null!=b&&$jscomp.defineProperty(d,a,{configurable:!0,writable:!0,value:b})};
$jscomp.polyfillIsolated=function(a,b,d,f){var e=a.split(".");a=1===e.length;f=e[0];f=!a&&f in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var h=0;h<e.length-1;h++){var g=e[h];if(!(g in f))return;f=f[g]}e=e[e.length-1];d=$jscomp.IS_SYMBOL_NATIVE&&"es6"===d?f[e]:null;b=b(d);null!=b&&(a?$jscomp.defineProperty($jscomp.polyfills,e,{configurable:!0,writable:!0,value:b}):b!==d&&(void 0===$jscomp.propertyToPolyfillSymbol[e]&&(d=1E9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[e]=$jscomp.IS_SYMBOL_NATIVE?
$jscomp.global.Symbol(e):$jscomp.POLYFILL_PREFIX+d+"$"+e),$jscomp.defineProperty(f,$jscomp.propertyToPolyfillSymbol[e],{configurable:!0,writable:!0,value:b})))};
$jscomp.getConstructImplementation=function(){function a(){function d(){}new d;Reflect.construct(d,[],function(){});return new d instanceof d}if($jscomp.TRUST_ES6_POLYFILLS&&"undefined"!=typeof Reflect&&Reflect.construct){if(a())return Reflect.construct;var b=Reflect.construct;return function(d,f,e){d=b(d,f);e&&Reflect.setPrototypeOf(d,e.prototype);return d}}return function(d,f,e){void 0===e&&(e=d);e=$jscomp.objectCreate(e.prototype||Object.prototype);return Function.prototype.apply.call(d,e,f)||
e}};$jscomp.construct={valueOf:$jscomp.getConstructImplementation}.valueOf();$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},b={};try{return b.__proto__=a,b.a}catch(d){}return!1};$jscomp.setPrototypeOf=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,b){a.prototype=$jscomp.objectCreate(b.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var d=$jscomp.setPrototypeOf;d(a,b)}else for(d in b)if("prototype"!=d)if(Object.defineProperties){var f=Object.getOwnPropertyDescriptor(b,d);f&&Object.defineProperty(a,d,f)}else a[d]=b[d];a.superClass_=b.prototype};$jscomp.getRestArguments=function(){for(var a=Number(this),b=[],d=a;d<arguments.length;d++)b[d-a]=arguments[d];return b};
var windows=window,documents=document,math=Math,PI=math.PI,timer=performance,l=windows.localStorage;Rand=function(a){return math.random()*a};RandInt=function(a){return Rand(a)|0};RandIntBetween=function(a,b){return a+RandInt(b-a+1)};Abs=function(a){return math.abs(a)};Distance=function(a,b){return math.hypot(a,b)};CollisionRect=function(a,b){return a.x+a.w>b.x&&b.x+b.w>a.x&&a.y+a.h>b.y&&b.y+b.h>a.y?1:0};Max=function(a,b){return a>b?a:b};Min=function(a,b){return a<b?a:b};IntToString=function(a){return a.toString()};
Pad=function(a){return a.padStart(4,"0")};ToFixed=function(a){return a.toFixed(2)};StringToFloat=function(a){return parseFloat(a)};SlopeY=function(a,b,d){return a*(void 0===d?-20:d)+b};localSet=function(a,b){return l.setItem(a,b)};localGet=function(a){return l.getItem(a)};GetCanvas=function(a){return documents.getElementById(a)};GetContextAlpha=function(a){return a.getContext("2d",{alpha:!1,desynchronized:!0})};GetContext=function(a){return a.getContext("2d")};CreateElement=function(a){return documents.createElement("canvas")};
CanvasToImage=function(a){var b=new Image;b.src=a.toDataURL();return b};var innerWidth,canvasWidth,canvasHeight,mouseCanvas,resizeWindow,tw,th,count=1,canvas=GetCanvas("a"),ctx=GetContextAlpha(canvas),GamePlayObject=[],BackgroundMoveObject=[],BadItemImage=[],wallSpeed=[4,4,4,4,4,4,4,4,8,8,8,8,8,8,16,16,16,16,32],levelUpMeter=wallSpeed.map(function(a,b){return 5+20*b}),level=1,SunToMoon=RandInt(3),key={},key1={},checkButton=[],startButton,returnButton,INKEYIN=0,keyStopRestartMute=["r","m","p"];
keyStopRestartMute.forEach(function(a){return key1[a]=0});InitailLoopDict=function(a,b){for(var d in a)a[d]=b;return a};key1.r=1;onblur=function(a){key1.p=1;key1.m=0};onfocus=function(a){return key1.p=0};
onmousedown=function(a){INKEYIN||(zzfxX=new (window.AudioContext||webkitAudioContext),Music(),INKEYIN=1);if(!a.button){a.pageX>innerWidth/2?key.s=1:key.a=1;var b=a.clientX-mouseCanvas.left,d=a.clientY-mouseCanvas.top,f=w=1;checkButton.forEach(function(e,h){CollisionRect(e,{x:b/2,y:d/2,w:w,h:f})&&(key1[keyStopRestartMute[h]]=!key1[keyStopRestartMute[h]])});startButton&&CollisionRect(startButton,{x:b/2,y:d/2,w:w,h:f})&&(NewGame(),key1.r=0);returnButton&&CollisionRect(returnButton,{x:b/2,y:d/2,w:w,h:f})&&
(NewGame(),key1.r=1)}};onmouseup=function(a){a.button?0:key=InitailLoopDict(key,0);INKEYIN&&key1.m&&PlaySound(1)};
ontouchstart=function(a){var b=a.changedTouches[0].pageX,d=a.changedTouches[0].pageY,f=w=1;b>innerWidth/2?key.s=1:key.a=1;checkButton.forEach(function(e,h){CollisionRect(e,{x:b/2,y:d/2,w:w,h:f})&&(key1[keyStopRestartMute[h]]=!key1[keyStopRestartMute[h]])});startButton&&CollisionRect(startButton,{x:b/2,y:d/2,w:w,h:f})&&(INKEYIN||(zzfxX=new (window.AudioContext||webkitAudioContext),Music(),INKEYIN=1),NewGame(),key1.r=0);returnButton&&CollisionRect(returnButton,{x:b/2,y:d/2,w:w,h:f})&&(NewGame(),key1.r=
1)};ontouchend=function(a){INKEYIN&&key1.m&&PlaySound(1);key=InitailLoopDict(key,0)};onkeydown=function(a){INKEYIN||(zzfxX=new (window.AudioContext||webkitAudioContext),Music(),INKEYIN=1);a=a.key;"r"==a&&NewGame();keyStopRestartMute.includes(a)?key1[a]=!key1[a]:key[a]=1};onkeyup=function(a){var b=a.key;("a"==b||"s"==b||"z"==b||"x"==b)&&INKEYIN&&key1.m&&PlaySound(1);key[a.key]=0};
var resize=function(){var a=windows.innerWidth,b=Min(Min(a,windows.innerHeight)/32|0,24);tw=canvasWidth=canvas.width=32*b;th=canvasHeight=canvas.height=32*b+4*b;ctx.imageSmoothingEnabled=!1;tw=canvasWidth/2;th=canvasHeight/2;innerWidth=a;mouseCanvas=canvas.getBoundingClientRect();checkButton=[];resizeWindow=0};onresize=function(a){return resize()};resize();var zzfxX=null;zzfxV=.3;zzfxR=44100;
Music=function(){zzfx=function(){var a=$jscomp.getRestArguments.apply(0,arguments);return zzfxP(zzfxG.apply(null,$jscomp.arrayFromIterable(a)))}};zzfxP=function(){var a=$jscomp.getRestArguments.apply(0,arguments),b=zzfxX.createBufferSource(),d=zzfxX.createBuffer(a.length,a[0].length,zzfxR);a.map(function(f,e){return d.getChannelData(e).set(f)});b.buffer=d;b.connect(zzfxX.destination);b.start();return b};
zzfxG=function(a,b,d,f,e,h,g,k,m,x,r,C,z,A,t,D,p,E,B,F){a=void 0===a?1:a;b=void 0===b?.05:b;d=void 0===d?220:d;g=void 0===g?0:g;k=void 0===k?1:k;m=void 0===m?0:m;A=void 0===A?0:A;t=void 0===t?0:t;D=void 0===D?0:D;E=void 0===E?1:E;F=void 0===F?0:F;var q=2*Math.PI,K=m*=500*q/Math.pow(zzfxR,2),L=(0<t?1:-1)*q/4;b=d*=(1+2*b*Math.random()-b)*q/zzfxR;var I=[],u=0,M=0,n=0,G=1,O=0,P=0,H=0,J;f=99+zzfxR*(void 0===f?0:f);B=(void 0===B?0:B)*zzfxR;e=(void 0===e?0:e)*zzfxR;h=(void 0===h?.1:h)*zzfxR;p=(void 0===
p?0:p)*zzfxR;x=500*q/Math.pow(zzfxR,3)*(void 0===x?0:x);t*=q/zzfxR;r=q/zzfxR*(void 0===r?0:r);C=(void 0===C?0:C)*zzfxR;z=zzfxR*(void 0===z?0:z)|0;for(J=f+B+e+h+p|0;n<J;I[n++]=H){++P%(100*D|0)||(H=g?1<g?2<g?3<g?Math.sin(Math.pow(u%q,3)):Math.max(Math.min(Math.tan(u),1),-1):1-(2*u/q%2+2)%2:1-4*Math.abs(Math.round(u/q)-u/q):Math.sin(u),H=(z?1-F+F*Math.sin(2*Math.PI*n/z):1)*(0<H?1:-1)*Math.pow(Math.abs(H),k)*a*zzfxV*(n<f?n/f:n<f+B?1-(n-f)/B*(1-E):n<f+B+e?E:n<J-p?(J-n-p)/h*E:0),H=p?H/2+(p>n?0:(n<J-p?1:
(J-n)/p)*I[n-p|0]/2):H);var N=(d+=m+=x)*Math.sin(M*t-L);u+=N-N*A*(1-1E9*(Math.sin(n)+1)%2);M+=N-N*A*(1-1E9*(Math.pow(Math.sin(n),2)+1)%2);G&&++G>C&&(d+=r,b+=r,G=0);!z||++O%z||(d=b,m=K,G=G||1)}return I};
zzfxM=function(a,b,d,f){for(var e,h,g,k,m,x,r,C,z,A,t,D,p,E,B=0,F=[],q=[],K=[],L=0,I=0,u=1,M={},n=zzfxR/(void 0===f?125:f)*60>>2;u;L++)F=[u=C=D=0],d.map(function(G,O){r=b[G][L]||[0,0,0];u|=!!b[G][L];E=D+(b[G][0].length-2-!C)*n;p=O==d.length-1;h=2;for(k=D;h<r.length+p;C=++h){m=r[h];z=h==r.length+p-1&&p||A!=(r[0]||0)|m|0;for(g=0;g<n&&C;g++>n-99&&z?t+=(1>t)/99:0)x=(1-t)*F[B++]/2||0,q[k]=(q[k]||0)-x*I+x,K[k]=(K[k++]||0)+x*I+x;m&&(t=m%1,I=r[1]||0,(m|=0)&&(F=M[[A=r[B=0]||0,m]]=M[[A,m]]||(e=[].concat($jscomp.arrayFromIterable(a[A])),
e[2]*=Math.pow(2,(m-12)/12),0<m?zzfxG.apply(null,$jscomp.arrayFromIterable(e)):[])))}D=E});return[q,K]};
var v=.2,Sound={1:[v,,443,,.1,0,1,,-8.7,,,,,.6,,,,0,.03],2:[v,,887,.01,.06,.42,3,1.02,,.7,,,,.8,,1,,.36,.12],3:[v,,64,.06,.19,.3,1,.84,.1,-.5,216,.12,.17,,,.1,,.91,.15],song1:[[[,0,400]],[[[,-1,5,,,,,,5,,,,,5,,8,,13,13,,,,,6,,10,3,12,,12,,,,5,,8,,13,,13,,,,],[,1,,,8,,12,,8,,,,,,,,,,8,,,,,,,,,,,10,,,,,,,,,,8,,,,],[,-1,,,,,,,12,,,,,,,,,,5,,,,,,,,,,,6,,,,,,,,,,5,,,,]]],[0],,],song2:[[[,0,150]],[[[,,6,,,,22,,,13,10,,,1,5,,,,24,,,17,10,,,5,8,,,17,,22,,,24,,,18],[,-.1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,,],[,,27,29,30,32,34,32,30,29,30,32,34,36,36,34,32,34,32,34,36,36,36,34,36,32,32,34,36,34,36,34,36,32,34,36,29,25]]],[0],110]},SoundNode;PlaySound=function(a){zzfx.apply(null,$jscomp.arrayFromIterable(Sound[a]))};PlaySong=function(a){zzfxV=1;a=zzfxM.apply(null,$jscomp.arrayFromIterable(Sound[a]));SoundNode&&SoundNode.stop();SoundNode=zzfxP.apply(null,$jscomp.arrayFromIterable(a));SoundNode.loop=1};StopSong=function(a){zzfxV=0;SoundNode.stop()};
CanPlaysong=function(a){SoundNode&&StopSong();INKEYIN&&key1.m?PlaySong(a):0};shadeColor=function(a,b){a=a.substr(1);var d=parseInt(a,16),f=Math.round(2.55*b),e=(d>>16)+f,h=(d>>8&255)+f;d=(d&255)+f;return"#"+(16777216+65536*(255>e?1>e?0:e:255)+256*(255>h?1>h?0:h:255)+(255>d?1>d?0:d:255)).toString(16).slice(1)};
rect1=function(a,b,d,f,e,h,g,k){h=void 0===h?"red":h;g=void 0===g?5:g;k=void 0===k?0:k;a.save();a.fillStyle=h;a.strokeStyle=h;a.beginPath();a.lineWidth=2;a.moveTo(b,d);a.lineTo(b+f,d);a.arcTo(b+f+g,d,b+f+g,d+g,g);a.lineTo(b+f+g,d+e+g);a.arcTo(b+f+g,d+e+g+g,b+f,d+e+g+g,g);a.lineTo(b,d+e+g+g);a.arcTo(b-g,d+e+g+g,b-g,d+e+g,g);a.lineTo(b-g,d+g);a.arcTo(b-g,d,b,d,g);k?a.fill():a.stroke();a.closePath();a.restore()};
CreateWall=function(a){var b=CreateElement(),d=GetContext(b),f;var e=f=b.width=b.height=32;d.scale(2,2);d.fillStyle=shadeColor(a,-10);d.fillRect(0,0,e,f);e/=6;f/=6;for(var h=y=c=0,g=0,k=0;9>k;k++){d.fillStyle=shadeColor(a,RandInt(3));var m=RandInt(e/2);d.fillRect(h+g,y,e+m,f);g=m;2==c?(y+=f,h=c=0):(h+=e,c++)}return CanvasToImage(b)};
CreateItem=function(a,b,d,f){f=void 0===f?0:f;var e=CreateElement(),h=GetContext(e);e.width=e.height=64;h.translate(32,32);h.rotate(PI*f);h.translate(-32,-32);rect1(h,d.x,d.y,d.w,d.h,b,d.r,a);h.setTransform(1,0,0,1,0,0);return CanvasToImage(e)};CreateItemDraw=function(a,b){for(var d=[],f=0;f<b;f++)d.push(CreateItem(a[0],shadeColor(a[1],1),{x:a[2][0]+f*a[3][0],y:a[2][1]+f*a[3][1],w:a[2][2]+f*a[3][2],h:a[2][3]+f*a[3][3],r:a[2][4]+f*a[3][4]},f*a[4]));return d};
CreateCloud=function(a,b){var d=CreateElement(),f=GetContext(d);f.height=50;f.width=18*a+20;f.beginPath();f.moveTo(20,20);f.fillStyle=b;for(var e=1;e<a;e++)f.quadraticCurveTo(20+10*e,10,20+20*e,20);f.quadraticCurveTo(20+20*e,45,20+18*(e-1),40);f.moveTo(20,20);f.quadraticCurveTo(10,30,30,40);for(e=1;e<a;e++)f.quadraticCurveTo(20+10*e,50,20+18*e,40);f.fill();f.stroke();return CanvasToImage(d)};
cloudDrawImageFrame=function(a){a={};var b,d,f=["#fff","#58B","#BBC"];for(d=0;3>d;d++)for(a[d]=[],b=3;6>b;b++)a[d].push(CreateCloud(b,f[d]));return a};var cloudDrawImage=cloudDrawImageFrame(),Vector=function(a,b,d,f){d=void 0===d?32:d;this.x=a;this.y=b;this.h=void 0===f?32:f;this.maxWidth=this.w=d};Vector.prototype.set=function(a){this.x=a.x;this.y=a.y;return this};Vector.prototype.add=function(a){this.x+=a.x;this.y+=a.y};Vector.prototype.addOne=function(a){this.x+=a;this.y+=a};
Vector.prototype.addX=function(a){this.x+=a.x};Vector.prototype.zero=function(){this.x=this.y=0};Vector.prototype.substract=function(a){this.x-=a.x;this.y-=a.y;return this};Vector.prototype.dot=function(a){this.x*=a;this.y*=a;return this};Vector.prototype.clone=function(){return new Vector(this.x,this.y,this.w,this.h)};Vector.prototype.norm=function(a){var b=a.x-this.x;a=a.y-this.y;var d=Distance(b,a);return new Vector(b/d,a/d)};Vector.prototype.size=function(a,b){this.w*=(this.maxWidth-a.w)/(b-a.y)};
Vector.prototype.less=function(a,b){return this.x<a||this.y<b};Vector.prototype.collisionRect=function(a){return CollisionRect(this,a)};var PlayerConfig={speed:1,maxSpeed:32,targetPos:new Vector(tw/2,-th,2,2),score:0,meter:0,life:100,maxScore:0,maxMeter:0},player=null,GameObject=function(a,b,d,f,e){f=void 0===f?32:f;e=void 0===e?32:e;this.pos=new Vector(a,b,f,e);this.VectorXY=new Vector(0,0,f,e);this.w=f;this.h=e;this.p=d;this.frameTime=0;GamePlayObject.push(this)};
GameObject.prototype.render=function(a){this.draw();this.update(a)};GameObject.prototype.draw=function(){};GameObject.prototype.update=function(a){};GameObject.prototype.remove=function(){GamePlayObject.splice(GamePlayObject.indexOf(this),1)};
hand=function(a,b,d,f,e,h,g){e=void 0===e?0:e;h=void 0===h?90:h;g=void 0===g?250:g;ctx.save();ctx.translate(a,b);ctx.rotate(PI/360*h);ctx.translate(-a,-b);rect1(ctx,a+2,b+2*e+2*f,1,1,"black",e/5);ctx.fillStyle="#0fa";ctx.fill();rect1(ctx,a,b,d,f+2*e,"black",e/8);ctx.fillStyle="#fff";ctx.fill();ctx.restore();ctx.save();ctx.translate(a,b);ctx.rotate(PI/360*g);ctx.translate(-a,-b);rect1(ctx,a,b,d+f,f+2*e,"black",e/8);ctx.fillStyle="#fff";ctx.fill();rect1(ctx,a,b+2*e+2*f,d+f,f,"black",e/8);ctx.fillStyle=
"#0ff";ctx.fill();ctx.restore()};face=function(a,b,d,f,e,h,g,k,m){h=void 0===h?230:h;g=void 0===g?-20:g;k=void 0===k?0:k;m=void 0===m?0:m;hand(a,b,d,f/4,e,h,430+h/10);hand(a,b,d,f/4,e,g,330+g/10);ctx.save();ctx.fillStyle="#fff";rect1(ctx,a,b-1.5*e,d,f+e/1.5,"black",e-e/4);rect1(ctx,a,b-1.5*e,d,f+e/1.5,"white",e-e/4,1);rect1(ctx,a,b,d,f,"black",e);rect1(ctx,a,b,d,f,"white",e,1);eye(a,b,d,f,e,k,m);ctx.restore()};
eye=function(a,b,d,f,e,h,g){ctx.save();rect1(ctx,a-e/3,b+1.5*e,2,2,"#111",e/4);rect1(ctx,a-e/3+h,b+1.7*e,2,2,"#111",e/8,1);rect1(ctx,a+e/2,b+1.5*e,2,2,"#111",e/4);rect1(ctx,a+e/2+h,b+1.7*e,2,2,"#111",e/8,1);ctx.beginPath();ctx.moveTo(a-e/4,b+e/4);ctx.quadraticCurveTo(a-e/4*g,b+e,a-e/4+d+e/2,b+e/4);ctx.stroke();ctx.fillStyle="#DD404B";ctx.fill();ctx.closePath();rect1(ctx,a-e/4,b+e/4,d+e/2,f+e/4,"#111",1);ctx.restore()};
var Faller=function(a,b,d,f){GameObject.call(this,a,b,1,d,f);this.D=0;this.frameTime=1;this.tw=tw;this.life=100;this.leftAni=this.rightAni=this.score=0;this.rightHandAngle=90;this.leftHandAngle=-90;this.oldmeter=this.meter=this.tonePos=this.toneAni=0};$jscomp.inherits(Faller,GameObject);
Faller.prototype.draw=function(){ctx.save();1>this.frameTime&&(ctx.globalCompositeOperation="xor",rect1(ctx,this.pos.x,this.pos.y,this.w,this.h,"#aaa",5,10));face(this.pos.x+this.w/2.5,this.pos.y-this.w/4,5,5,this.w-this.w/8,this.leftHandAngle,this.rightHandAngle,this.D,this.tonePos);ctx.restore()};
Faller.prototype.move=function(a){a*=200;this.meter+=a;this.leftHandAngle+=this.leftAni?2:-2;this.rightHandAngle+=this.rightAni?2:-2;this.tonePos+=this.toneAni?.6:-.6;this.rightAni=200<this.rightHandAngle?0:this.rightAni;this.rightAni=80>this.rightHandAngle?1:this.rightAni;this.leftAni=-80<this.leftHandAngle?0:this.leftAni;this.leftAni=-200>this.leftHandAngle?1:this.leftAni;this.toneAni=-3>this.tonePos?1:this.toneAni;this.toneAni=3<this.tonePos?0:this.toneAni;this.VectorXY.zero();this.meter/100>(levelUpMeter[level]||
270)&&(this.oldmeter=this.meter,level++,INKEYIN&&key1.m?PlaySound(3):0);if(key.a||key.A||key.z||key.Z)this.VectorXY.substract(new Vector(a,0)),this.rightHandAngle+=this.rightAni?5:-5,this.D=-2;if(key.S||key.s||key.X||key.x)this.VectorXY.add(new Vector(a,0)),this.leftHandAngle+=this.leftAni?5:-5,this.D=2;this.oldPos=this.pos.clone();this.pos.addX(this.VectorXY);this.pos.x>tw-tw/5.5&&(this.pos=this.oldPos.substract(this.VectorXY));this.pos.x<tw/8.5&&(this.pos=this.oldPos.substract(this.VectorXY))};
Faller.prototype.update=function(a){var b=this;this.move(a);this.frameTime+=a;1<=this.frameTime&&(this.score+=.1*a*level,this.life+=1.5*a,this.life=Min(this.life,100));GamePlayObject.forEach(function(d){2<=d.p&&d.pos.collisionRect(b.pos)&&1<b.frameTime&&2==d.p&&(b.life-=20,b.frameTime=0,b.hurt())});0>=this.life&&this.destory()};
Faller.prototype.destory=function(){for(var a=0;30>a;a++)new Blood(this.pos.x,this.pos.y,RandIntBetween(5,10),shadeColor("#640D14",RandInt(5)));PlayerConfig.maxMeter=ToFixed(Max(this.meter/100|0,parseFloat(PlayerConfig.maxMeter)));PlayerConfig.maxScore=Max(this.score,PlayerConfig.maxScore)|0;localSet("M",PlayerConfig.maxMeter);localSet("S",PlayerConfig.maxScore);this.remove()};
Faller.prototype.hurt=function(){for(var a=0;20>a;a++)new Blood(this.pos.x,this.pos.y,5,shadeColor("#9A2D26",RandInt(20)));INKEYIN&&key1.m?PlaySound(2):0};var Blood=function(a,b,d,f){GameObject.call(this,a,b,0,d,d);this.dx=(.5>Rand(1)?3:-3)*Rand(3)*.8;this.dy=(.5>Rand(1)?3:-3)*Rand(3)*.8;this.c=f};$jscomp.inherits(Blood,GameObject);Blood.prototype.draw=function(){rect1(ctx,this.pos.x,this.pos.y,2,2,this.c,this.pos.w,1)};
Blood.prototype.update=function(a){this.frameTime+=a;3<this.frameTime||.3>this.pos.w?this.remove():0;this.dy-=.9*a;this.pos.x-=this.dx;this.pos.y-=this.dy;this.pos.w-=.05;this.pos.w=Max(this.pos.w,1)};var Cloud=function(a,b,d){GameObject.call(this,a,b,0,0,0);this.frames=d};$jscomp.inherits(Cloud,GameObject);Cloud.prototype.draw=function(){ctx.drawImage(this.frames,this.pos.x,this.pos.y,this.frames.width,this.frames.height)};
Cloud.prototype.update=function(a){this.VectorXY=this.pos.norm(new Vector(this.pos.x,-th));this.VectorXY.dot(level);this.pos.add(this.VectorXY);this.pos.less(0,-this.frames.height)&&this.destory()};Cloud.prototype.destory=function(){var a=cloudDrawImage[RandInt(2)];new Cloud(this.pos.x,th+Rand(300),a[RandInt(a.length)]);this.remove()};var Item=function(a,b,d,f,e,h){GameObject.call(this,a,b,h,d,f);this.initialX=this.pos.x;this.frameArray=e;this.curFrame=e[0];this.frameTime=0;this.th=th};
$jscomp.inherits(Item,GameObject);Item.prototype.draw=function(){ctx.drawImage(this.curFrame,this.pos.x,this.pos.y,this.pos.w,this.pos.h)};
Item.prototype.update=function(a){a=this.frameArray.length;this.frameTime++;this.curFrame=this.frameArray[this.frameTime%a|0];var b=this.initialX+1;b=this.pos.x>=tw/2?Min(tw-tw/7,this.initialX)-this.w:Max(tw/4,b);this.VectorXY=this.pos.norm(new Vector(b,-this.th));this.VectorXY.dot(level);this.pos.add(this.VectorXY);this.pos.w-=this.pos.maxWidth/Distance(0,2*this.th)*Abs(this.VectorXY.y);this.pos.w=Max(this.pos.w,this.pos.maxWidth/2);this.pos.less(0,-this.pos.h)&&this.destory();this.frameTime=this.frameTime>
2*a?0:this.frameTime};Item.prototype.destory=function(){this.remove()};var BuildingWall=function(a,b,d,f,e){e=void 0===e?"#5F6256":e;this.pos=new Vector(a,b,d,f);this.VectorXY=this.pos.clone();this.initialX=a;this.initialY=canvasHeight/2;this.f=CreateWall(e);this.th=th;this.colorCount=this.meter=this.frameTime=0;BackgroundMoveObject.push(this)};BuildingWall.prototype.render=function(a){this.draw();this.update(a)};
BuildingWall.prototype.draw=function(){ctx.drawImage(this.f,this.pos.x,this.pos.y,this.pos.w,this.pos.h)};BuildingWall.prototype.update=function(a){this.VectorXY=this.pos.norm(new Vector(this.pos.x,-this.th,1,1));this.meter+=200*a;this.VectorXY.dot(wallSpeed[level]||32);PlayerConfig.speed=this.VectorXY.y;this.pos.less(0,-this.pos.h)&&this.loop();this.pos.add(this.VectorXY)};BuildingWall.prototype.loop=function(){this.pos.set({x:this.initialX,y:this.th})};
background=function(a){a=CreateElement();var b=GetContext(a);a.width=tw;a.height=th;var d=b.createRadialGradient(tw,0,40,tw,0,th/10);d.addColorStop(.3,"#FFE261");d.addColorStop(.7,"#F3CD05");d.addColorStop(.8,"#F49F05");d.addColorStop(1,"#FFF8C8");b.beginPath();b.fillStyle=d;b.fillRect(0,0,tw,th);for(d=0;d<tw;d+=40){var f=RandIntBetween(th/4,th-th/8),e=shadeColor("#36688D",RandIntBetween(-20,20));rect1(b,RandIntBetween(0,tw),th-f,RandInt(64),f,e,8,1)}return CanvasToImage(a)};var back=background();
BackgroundView=function(a){ctx.drawImage(back,0,0,tw,th)};BuildingWallInitial=function(a){for(a=0;a<th/28;a++)for(var b=0;b<tw/32;b++)new BuildingWall(32*b,32*a,32,32);CloudCreate(0)};CloudCreate=function(a){a=cloudDrawImage[SunToMoon];for(var b=0;10>b;b++){var d=b%2?RandIntBetween(tw-tw/8,tw):RandIntBetween(0,tw/18)-Rand(10);new Cloud(d,th+Rand(300),a[RandInt(a.length)])}};
TextField=function(a,b,d,f,e,h){e=void 0===e?"#fff":e;h=void 0===h?1:h;ctx.save();ctx.fillStyle=e;ctx.font=f+"px Impact";ctx.fillText(a,b,d);h?ctx.strokeText(a,b,d):0;ctx.restore()};Bar=function(a,b,d,f,e,h){ctx.save();var g=d/e*f;rect1(ctx,a,b+(d-g),5,g,"#1fc",5,1);rect1(ctx,a,b,5,d,"#000");for(g=0;g<f;g+=25)rect1(ctx,a,b+(d-d/e*g),8,1,"#a11",1,1);ctx.fillStyle="#0F0";ctx.font="20px Impact";ctx.fillText(h,a-11,b+d+20);ctx.restore()};
var miniMapY,reachColor="#b88 #8b8 #88b #FFE8D6 #DDBEA9 #5F6256 #7C6354 #F9FBB2 #B5179E".split(" "),cur1color=1,cur2color=0;ScaleLine=function(a,b,d,f,e){e=void 0===e?200:e;ctx.save();ctx.beginPath();ctx.lineWidth=3;for(var h=0,g=0;h<=e;h+=2*d,g++)ctx.strokeStyle="#fff",5==g?rect1(ctx,a-d/2,b+h,d,d,reachColor[f],5,1):rect1(ctx,a+d/2,b+h,-d,d),ctx.stroke();ctx.restore()};
GameUIView=function(a){ctx.save();ctx.beginPath();var b=1,d;for(d in keyStopRestartMute){ctx.globalAlpha=Max(1-key1[keyStopRestartMute[d]],.5);var f=tw-20*b-5;resizeWindow?0:checkButton.push({x:f,y:10,w:18,h:12});ctx.fillText(b-1?b-2?"\u23ef\ufe0f":"\ud83c\udfa7":"\ud83c\udfe0",f,20);b++}ctx.restore();resizeWindow=1;ctx.save();ctx.beginPath();ctx.fillStyle="#fff";ctx.font="30px Impact";b=Pad(IntToString(Min(player.score|0,9999)));TextField(b,tw-70,60,30);TextField("Meter",10,25,15);TextField(ToFixed(player.meter/
100)+" /m",15,40,12);TextField("G-Speed",10,60,15);TextField(ToFixed(level+Rand(a))+" /g",15,80,12);ScaleLine(20,th/2,10,cur1color,100);Bar(tw-20,80,40,player.life|0,100,"\ud83e\udde1");miniMapY=100/levelUpMeter[level]*(player.meter-player.oldmeter)/100*level;rect1(ctx,25,th/2+miniMapY,2,2,reachColor[cur2color],2,1);87<=miniMapY&&(cur2color=cur1color,cur1color++,cur1color=cur1color>=reachColor.length?0:cur1color);ctx.restore()};
var itemColor="#25315D",iron_ball_shake=CreateItemDraw([1,itemColor,[64,32,-64,-64,30],[0,0,0,0,0],.5],20),long_wall=CreateItemDraw([1,itemColor,[16,16,32,-38,16],[0,0,0,0,0],0],1),iron_ball_rotate=CreateItemDraw([0,itemColor,[64,32,-64,-64,30],[0,0,0,0,0],.5],20),fix_arrow=CreateItemDraw([1,itemColor,[64,32,-64,-64,32],[0,-1,0,0,1],0],30),ciclre=CreateItemDraw([1,itemColor,[64,32,-64,-64,32],[0,-1,0,0,1],.1],30),fansa=CreateItemDraw([1,itemColor,[64,0,-64,-64,64],[0,0,0,0,0],.1],10),adsf=CreateItemDraw([0,
itemColor,[64,32,-64,-32,32],[0,-1,0,-1,-.1],.1],30);BadItemImage=[iron_ball_shake,long_wall,fansa,fix_arrow,ciclre,iron_ball_rotate,adsf];AppearArry=function(a){for(a=new Set;6>a.size;)a.add(RandInt(6));return[].concat($jscomp.arrayFromIterable(a))};AppearDist=function(a){return a.join("").replace("0","#0#").split("#").filter(function(b){return b})};WallResize=function(a){return a.map(function(b){return"0"!=b?b.length*tw/8:tw/6})};
Pause=function(a){ctx.save();ctx.fillStyle="rgba(10,10,10,.5)";ctx.fillRect(0,0,tw,th);TextField("-- PAUSE --",tw/2-tw/4,th/2+th/15,tw/15+th/15);ctx.restore()};var lightx=scaleOut=0;
Start=function(a){ctx.save();TextField("- FALL\u3000 -",tw/2-tw/4,th/5,tw/15+th/15);TextField("- DOWN\u3000-",tw/2-tw/4,th/3,tw/15+th/15);TextField("Score:"+Pad(IntToString(PlayerConfig.maxScore)),tw/2-tw/8,th/2+th/6,tw/15,"#b88");TextField("Meter:"+Pad(IntToString(PlayerConfig.maxMeter)),tw/2-tw/8,th/2+th/4,tw/15,"#8b8");TextField("Touch Me",tw/2-tw/7.5,th-th/10,tw/15,shadeColor("#aaaaaa",lightx));rect1(ctx,tw/2-tw/4,th-th/5,tw/2,th/8,shadeColor("#aaaaaa",lightx));startButton={x:tw/2-tw/4,
y:th-th/5,w:tw/2,h:th/8};lightx+=1;lightx=40<lightx?0:lightx;GamePlayObject.forEach(function(b){b instanceof Cloud&&b.render()});ctx.restore()};
End=function(a){ctx.save();ctx.fillStyle="rgba(10,10,10,.5)";ctx.fillRect(0,0,tw,th);rect1(ctx,tw/2-tw/4,th/4,tw/2,th/2,shadeColor("#555555",1),5,1);rect1(ctx,tw/2-tw/4,th/4,tw/2,th/2,shadeColor("#aaaaaa",lightx));rect1(ctx,tw/2-tw/4,th/4+th/9,tw/2,1,shadeColor("#F7DD72",lightx));TextField("Best",tw/2-tw/12,th/4+th/10,tw/10,"#F7DD72");TextField("Score : "+Pad(IntToString(PlayerConfig.maxScore)),tw/4+tw/10,th/4+th/5,tw/16,"#b88");TextField("Meter : "+Pad(IntToString(PlayerConfig.maxMeter)),tw/4+tw/
10,th/2,tw/16,"#8b8");rect1(ctx,tw/2-tw/9,th/2+th/32,tw/4,th/5,shadeColor("#F7DD72",lightx),5,1);returnButton={x:tw/2-tw/9,y:th/2+th/32,w:tw/4,h:th/5};TextField("AGAIN",tw/2-tw/9.5,th/2+th/5.5,tw/10,shadeColor("#8888bb",lightx));lightx+=1;lightx=40<lightx?0:lightx;ctx.restore()};var tutorialTimes=removetutorialTimes=0;
Tutorial=function(a){ctx.save();var b=tw,d=th;ctx.globalAlpha=.5;ctx.fillStyle="#333";ctx.fillRect(0,0,b,d);ctx.beginPath();ctx.strokeStyle=shadeColor("#eeeeee",tutorialTimes);ctx.setLineDash([9]);ctx.lineWidth=5;ctx.strokeRect(b/2+b/3.5,5,b/5,d/16);ctx.moveTo(b/2,0);ctx.lineTo(b/2,d*a*tutorialTimes);tutorialTimes+=2;removetutorialTimes+=a;tutorialTimes=math.min(d,tutorialTimes);ctx.globalAlpha=tutorialTimes/d;ctx.stroke();ctx.fillStyle=shadeColor("#eeeeee",tutorialTimes);ctx.font=b/20+"px sans-serif";
ctx.fillText("Move Left",b/8,d-5);ctx.fillText("Move Right",b/8+b/2,d-5);a=b/4+b/2;var f=d/2+d/4;ctx.moveTo(a,f);ctx.bezierCurveTo(a+100,f+100,a-100,f,a,d-b/20);a=b/4;ctx.moveTo(a,f);ctx.bezierCurveTo(a+100,f+100,a-100,f,a,d-b/20);ctx.stroke();ctx.closePath();ctx.restore()};
ItemGenerator=function(a){var b=Min(RandInt(a),5),d=AppearArry(),f=Min(6,a);if(level%3||!level)d.forEach(function(g,k){if(g&&g<=b){var m=RandInt(f);new Item(k*tw/6,th+32,48,48,BadItemImage[m],2)}});else{var e=0,h=AppearDist(d);WallResize(h).forEach(function(g,k){"0"!=h[k]?new Item(e,th+32,g,32,BadItemImage[1],2):e+=tw/6;e+=g})}};
GameWorldInit=function(a){BackgroundMoveObject=[];BuildingWallInitial();BadItemImage=[iron_ball_shake,long_wall,iron_ball_rotate,fix_arrow,ciclre,fansa,adsf];GamePlayObject=GamePlayObject.filter(function(b){return b instanceof Cloud});PlayerConfig.maxScore=StringToFloat(localGet("S"))||0;PlayerConfig.maxMeter=StringToFloat(localGet("M"))||0};
NewGame=function(a){GamePlayObject=[];CloudCreate(RandInt(3));player=new Faller(tw/2,th/8,tw/16,th/16,10);startButton=returnButton=null;level=1;key1.p=0;key1.m=1;removetutorialTimes=0;CanPlaysong("song1")};var lastUpdate=timer.now(),distanceY=soundStop=0,changeSong=1;
Update=function(){var a=timer.now(),b=(a-lastUpdate)/1E3;lastUpdate=a;BackgroundView();!key1.m&&SoundNode?(StopSong(),soundStop=1):(soundStop&&(PlaySong(8>level?"song1":"song2"),soundStop=0),10<=level&&changeSong&&(StopSong(),PlaySong(10>level?"song1":"song2"),changeSong=0));key1.r?Start(b):key1.p?(Pause(),GameUIView(0)):(ctx.save(),ctx.strokeStyle="#FF1",ctx.fillStyle="#555",ctx.beginPath(),ctx.moveTo(tw/8,0),ctx.lineTo(0,th),ctx.lineTo(tw,th),ctx.lineTo(tw-tw/8,0),ctx.fill(),ctx.clip(),BackgroundMoveObject.forEach(function(d){d.render(b)}),
ctx.restore(),GamePlayObject.forEach(function(d){d.pos.y<=th?d.render(b):d.update(b)}),distanceY+=level,distanceY>=128+20*level&&(ItemGenerator(level),distanceY=0),0>=player.life&&End(b),5>=removetutorialTimes?Tutorial(b):removetutorialTimes=6,GameUIView(b))};MainLoop=function(a){ctx.clearRect(0,0,canvasWidth,canvasHeight);ctx.save();ctx.scale(2,2);tw=canvasWidth/2;th=canvasHeight/2;Update();ctx.restore();requestAnimationFrame(MainLoop)};GameWorldInit(0);MainLoop(0);
</script>
</html>