-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
1 lines (1 loc) · 18.7 KB
/
index.html
1
<html><head><title>Lost In Space</title></head><body style="margin: 0;"><canvas/><script>function lis(){const _t={"a":"right","b":"#fff","c":"24px Arial","d":"center","e":"36px Arial","f":"Continue? Press Enter","g":"Endless Destruction? Press Enter","h":"#600D","i":"addEventListener","j":"prototype","k":"position","l":"height","m":"fillStyle","n":"fillRect","o":"canvas","p":"forEach","q":"update","r":"statusText","s":"createOscillator","t":"exponentialRampToValueAtTime","u":"currentTime","v":"background","w":"beginPath","x":"acceleration","y":"getContext","z":"createPattern","A":"createElement"};const _s=setTimeout;const _m=Math;const Xb=_m.random;const Xa=_m.floor;const _d=document;const _a=window[_t.i];let t,e,s={};function i(t,...e){(s[t]||[]).map(t=>t(...e))}function n(){return e}const h=()=>{};class r{constructor(t=0,e=0,s={}){this.x=t,this.y=e}add(t){return new r(this.x+t.x,this.y+t.y,this)}}function o(){return new r(...arguments)}o[_t.j]=r[_t.j],o.t=r;class a extends class{constructor(t){return this.init(t)}init(t={}){this[_t.k]=o(),this.s=o(),Object.assign(this,t)}update(t){this.advance(t)}advance(t){let e=this.s;this[_t.k]=this[_t.k].add(e),this.i()}get dx(){return this.s.x}get dy(){return this.s.y}set dx(t){this.s.x=t}set dy(t){this.s.y=t}i(){}}{init({width:t=0,height:e=0,_c:s=n(),h:i=this.o,update:h=this.advance,anchor:r={x:0,y:0},_r:o=0,...a}={}){super.init({width:t,height:e,_c:s,anchor:r,_r:o,...a}),this.l=1,this.u(),this.p=i,this.g=h}h(t){let e=this._c;e.save(),(this.x||this.y)&&e.translate(this.x,this.y),this._r&&e.rotate(this._r);let s=-this.width*this.anchor.x,i=-this[_t.l]*this.anchor.y;(s||i)&&e.translate(s,i),this.p(),(s||i)&&e.translate(-s,-i),e.restore()}o(){}i(t,e){this.u()}get x(){return this[_t.k].x}get y(){return this[_t.k].y}set x(t){this[_t.k].x=t,this.i()}set y(t){this[_t.k].y=t,this.i()}get width(){return this.M}set width(t){this.M=t,this.i()}get height(){return this.m}set height(t){this.m=t,this.i()}u(){if(!this.l)return;let{A:t=0,S:e=0,C:s=0}=this.parent||{};this.A=this.x,this.S=this.y,this.v=this.width,this.T=this[_t.l],this.C=s+this._r;let{x:i,y:n}=function(t,e){let s=_m.sin(e),i=_m.cos(e);return{x:t.x*i-t.y*s,y:t.x*s+t.y*i}}({x:this.x,y:this.y},s);this.A=i,this.S=n}get k(){return{x:this.A,y:this.S,width:this.v,height:this.T,_r:this.C}}get _r(){return this.I}set _r(t){this.I=t,this.i()}}function c(){return new a(...arguments)}c[_t.j]=a[_t.j],c.t=a;class l extends c.t{init({...t}={}){super.init({...t})}o(){this.color&&(this._c[_t.m]=this.color,this._c[_t.n](0,0,this.width,this[_t.l]))}}function u(){return new l(...arguments)}u[_t.j]=l[_t.j],u.t=l;let d=/(\d+)(\w+)/;class f extends c.t{init({text:t="",textAlign:e="",lh:s=1,font:i=n().font,...h}={}){super.init({text:t,textAlign:e,lh:s,font:i,...h}),this.W()}get width(){return this.M}set width(t){this.F=1,this.M=t,this.O=t}get text(){return this.D}set text(t){this.F=1,this.D=t}get font(){return this.H}set font(t){this.F=1,this.H=t,this.P=function(t){let e=t.match(d),s=+e[1];return{size:s,N:e[2],_:s}}(t)._}get lh(){return this.R}set lh(t){this.F=1,this.R=t}h(){this.F&&this.W(),super.h()}W(){this.U=[],this.F=0;let t=this._c;t.font=this.font,this.U.length||(this.U.push(this.text),this.M=this.O||t.measureText(this.text).width),this[_t.l]=this.P+(this.U.length-1)*this.P*this.lh,this.u()}o(){let t=this.textAlign,e=this._c;this.U.map((s,i)=>{e.textBaseline="top",e.textAlign=t,e[_t.m]=this.color,e.font=this.font,e.fillText(s,0,this.P*this.lh*i)})}}function p(){return new f(...arguments)}function w(t){let e=t[_t.o];t.clearRect(0,0,e.width,e[_t.l])}p[_t.j]=f[_t.j],p.t=f;let x={},g={},M={Enter:"enter",Escape:"esc",Space:"space"};function y(t){let e=M[t.code];g[e]=1,x[e]&&x[e](t)}function m(t){g[M[t.code]]=0}function A(){g={}}function S(t){return!!g[t]}const C=(t,e)=>_m.sqrt(_m.pow(t.x-e.x,2)+_m.pow(t.y-e.y,2)),E=(t,e)=>_m.sqrt(_m.pow(t,2)+_m.pow(e,2)),b=(t,e)=>(_m.atan2(e.y-t.y,e.x-t.x)+_m.PI/2)%(2*_m.PI),v="Fire Rate Upgrade",T="Secondary Fire Rate Upgrade",k="Speed Upgrade",I="Hull Repaired",W="Secondary Weapons Online",F="Acceleration Increased",O="Rotor Speed Increased",D=function(t){return()=>(0==t&&t++,(t=1e4*_m.sin(t))-Xa(t))},H=t=>Array.apply(null,Array(t)).map((t,e)=>e),P=({width:t,height:e})=>{const s=[1.5*Xb(),Xb()-.5];return s[1]=_m.sign(s[1])+s[1],Xb()>.5&&s.reverse(),s[0]=Xa(s[0]*t),s[1]=Xa(s[1]*e),s},_={},N=t=>{if(S(t)){const e=_[t];if(_[t]=1,!e)return 1}else _[t]=0;return 0};class R extends c.t{$=[];L=1;constructor(t){super(t)}j(t){this.L=t}o(){const{_c:t}=this;this.L&&(t[_t.m]="#000",t[_t.n](-this.x,-this.y,t[_t.o].width,t[_t.o][_t.l])),t[_t.m]=_t.b,H(Xa(t[_t.o].width*t[_t.o][_t.l]*1e-4))[_t.p](e=>t[_t.n](-this.x+(this.x+(2*_m.pow(e,3)+33*e))%t[_t.o].width,-this.y+(this.y+(2*_m.pow(e,3)+16*e))%t[_t.o][_t.l],e%3+1,e%3+1))}update(t){if(super[_t.q](),this.$[_t.p]((e,s)=>{e[_t.q](),t-e.q>300&&this.$.splice(s,1)}),t%300==0){const[e,s]=P(this._c[_t.o]);this.$.push(new u({color:_t.b,x:e,y:s,width:2,height:4,q:t,dx:7*-_m.sign(e),dy:7*-_m.sign(s),_r:b({x:e,y:s},{x:-e,y:-s})}))}}h(){super.h(),this.$[_t.p](t=>t.h())}}const U={font:_t.c,color:_t.b,textAlign:_t.a};class $ extends c.t{B=[];Y=1;G=0;constructor(t){super(t);this.X=new p(U),this.K=new p(U),this.J=new p({font:"12px Arial",color:_t.b,text:"Press SPACE to skip"}),this.V=new u({color:"#6009"})}Z(t){this.G=t}h(){const t=this;t.X.h(),t.K.h(),t[_t.r]&&(t.V.h(),t[_t.r].h(),t.G&&t.J.h())}tt(t,e=6e3){this.B.push([t,e]),this[_t.r]||this.et()}et(){if(clearTimeout(this.st),this.B.length>0){const[t,e]=this.B.shift();this[_t.r]=new p({font:_t.c,color:_t.b,text:t,textAlign:_t.d,x:this._c[_t.o].width/2,y:20}),this.st=_s(()=>this.et(),e)}else this[_t.r]=null}update(t){const e=this,s=e._c[_t.o].width,i=e._c[_t.o][_t.l];e.X.x=s-20,e.X.y=i-20-24,e.K.x=s-20,e.K.y=i-45-20-24,e.X.text=`Scrap: ${t.it}t`,e.K.text=`Hull Integrity: ${t.nt}%`,e[_t.r]&&(e.V.width=s,e.V[_t.l]=64,e[_t.r].x=s/2,e[_t.r].y=20,e.G&&(e.J.x=s/2+150,e.J.y=47))}}class L extends u.t{constructor(t){super(t={...t,width:2,height:10,color:"#abab46",ht:0})}update(t,e){super[_t.q](),t.filter(t=>(({x:t,y:e},{x:s,y:i,width:n,height:h})=>t>s-n/2&&t<s+n/2&&e>i-h/2&&e<i+h/2)(this,t))[_t.p](t=>{this.ht=1,t.rt()}),C({x:e.ot+e.x,y:e.at+e.y},this)<=e.ct&&(this.ht=1)}}const j=window.AudioContext||window.webkitAudioContext;let q=()=>{},B=()=>{},Y=()=>{},z=()=>{};if(j){const t=new j;let e,s,i;q=()=>{const e=t[_t.s]();e.type="square";const s=t.createGain();s.gain.value=.15,s.gain[_t.t](1e-4,t[_t.u]+.04),e.frequency.value=100,e.connect(s),s.connect(t.destination),e.start(),_s(()=>e.stop(),100)},B=()=>{const e=t[_t.s]();e.type="sawtooth";const s=t.createGain();s.gain.value=.5,s.gain[_t.t](1e-4,t[_t.u]+.15),e.frequency.value=50,e.connect(s),s.connect(t.destination),e.start(),_s(()=>e.stop(),150)},Y=n=>{if(clearTimeout(i),e)s.cancelScheduledValues(t[_t.u]),s.setValueAtTime(.1,t[_t.u]);else{const i=t.createBiquadFilter();i.Q.value=20,e=[t[_t.s](),t[_t.s]()];const[h,r]=e;h.frequency.value=10*n,r.frequency.value=25,e[_t.p]((t,e)=>{t.type="triangle",t.connect(i),t.start(0)});const o=t.createGain();s=o.gain,s.value=.1,i.connect(o),o.connect(t.destination)}},z=()=>{s&&(s.setValueAtTime(s.value,t[_t.u]),s[_t.t](1e-5,t[_t.u]+.02)),i=_s(()=>{e&&e[_t.p](t=>t.stop()),e=null},20)},_a("keydown",()=>{t.resume()})}const G=window.localStorage;let X=G&&G.getItem("lins25_score")||0,K=G&&G.getItem("lins25_level")||0;class J extends c.t{lt=0;constructor(t,e){super(),z();const s=tt();this[_t.v]=new u({width:650,height:400,color:"#600A"}),this.ut=s.dt.map(t=>new p({font:"20px Arial",color:_t.b,text:t,textAlign:_t.d})),this.dt=new p({font:_t.e,color:_t.b,text:"Game Over",textAlign:_t.d}),this.ft=new p({font:_t.e,color:_t.b,text:"Score: "+t.it,textAlign:_t.d});const i=_m.max(X,t.it);X=i,e&&K++,G&&(G.setItem("lins25_score",i),G.setItem("lins25_level",K)),this.pt=new p({font:"18px Arial",color:_t.b,text:`High Score: ${i} scrap`,textAlign:_t.d}),this.wt=new p({font:_t.e,color:_t.b,text:e?s.xt:V,textAlign:_t.d}),this.lt=e,this[_t.q]()}h(){const t=this;t[_t.v].h(),t._c[_t.w](),t._c.strokeStyle=_t.b,this._c.rect(t[_t.v].x,t[_t.v].y,t[_t.v].width,t[_t.v][_t.l]),t._c.strokeWidth=5,t._c.stroke(),t.lt?t.ut[_t.p](t=>t.h()):t.dt.h(),t.ft.h(),t.pt&&t.pt.h(),t.wt.h()}update(){const t=this,e=t._c[_t.o].width/2,s=t._c[_t.o][_t.l]/2;t[_t.v].x=e-t[_t.v].width/2,t[_t.v].y=s-t[_t.v][_t.l]/2;const i=t.lt?0:48;t.lt?t.ut[_t.p]((i,n)=>{i.x=e,i.y=s-40*(t.ut.length-n)-20}):(t.dt.x=e,t.dt.y=s-56-i),t.ft.x=e,t.ft.y=s-i,t.pt&&(t.pt.x=e,t.pt.y=s+56-i),t.wt.x=e,t.wt.y=s+112-i}}const Q="Computer: Use my WASD keys to fly and The Bar to shoot. ESC to stop time.",V="Play Again? Press Enter",Z=[{level:0,it:100,gt:["Me: Where am I?","Computer: Error: 404. Location Not Found.","Me: It looks like I have drifted for 10 warp days. I will have to find my way back.","Me: This may be Corg space, I don't want to get assimil...assinated.","Me: Computer, System Status.","Computer: All systems have been destroyed.","Me: Ugh, now I need some scrap to fix the systems.","Computer: 200t of scrap are needed",Q],Mt:"Warp Drive Fixed, Warping in 5, 4, 3, 2, 1...",dt:["Me: These are the coordinates, where's Earth?","Computer: Error: 404. Earth not found.","Me: Okay... Are you broken?"],xt:"Continue? Press Enter"},{it:200,gt:["Me: Why is the ship broken again?","Computer: **Cough** **Cough**","Me: ... And why is my computer coughing?",Q],Mt:"Computer Fixed, Warping in 5, 4, 3, 2, 1...",dt:["Me: Seriously, where's Earth?","Computer: Error: 404. Earth not found.","Me: Maybe the DNS is down?"],xt:"Continue? Press Enter"},{it:300,gt:["Me: I need to fix the Dynamic Navigation System","Computer: Error: 404. Ship Not Found.","Me: You are the ship!!!",Q],Mt:"DNS Fixed, Warping in 5, 4, 3, 2, 1...",dt:["Me: Ok now what, where's Earth?","Computer: Error: 404.","Me: I'm getting tired of these error codes, can I turn off debug mode?"],xt:"Continue? Press Enter"},{it:400,gt:["Me: Computer Debug Mode Off","HAL: Error: 404. I'm afraid I can't let you do that.","Me: How about with enough juicy scrap?",Q],Mt:"Debug Mode Off, Warping in 5, 4, 3, 2, 1...",dt:["Me: I Win! Are we home?","Computer: Error: 404. Earth was destroyed 2 days ago.","Me: #*$& well I might as well see how many Corg I can destroy"],xt:"Endless Destruction? Press Enter"},{gt:["Me: Well let's get some Corg?","Computer: Error: 404. Corg Not Found.","Me: What is that then???",Q],dt:["Me: Well I had fun, how about you","Computer: Error: 404. Emotions not found.","Me: I think my real goal is to destroy you!"],xt:"Endless Destruction? Press Enter"}],tt=()=>Z[_m.min(K,Z.length-1)];let et;const st=[],it=[],nt=(t,e,s,i,n,h,r=n)=>{t[_t.w](),t.moveTo(e,s),t.lineTo(i,n),t.lineTo(h,r),t.fill()},ht=["#01b7e7","#ffb141","#cdccca","#8db9de","#f54c23","#ffb22b","#ca5c3b","#99ecfc","#b7b6b4"];class rt extends c.t{acceleration=.05;yt=.05;At=4;St=0;Ct=0;Et=[];bt=20;vt=-99;Tt=0;kt=15;It=-99;level=1;Wt=1;Ft=0;it=0;Ot=0;constructor(t,e){super({width:60,height:60,Dt:0,Ht:0,nt:100,anchor:{x:.5,y:.5}});const s=this,i=s._c;s.Pt=t,s._t=i.createLinearGradient(0,0,0,80),s._t.addColorStop(.6,"#f00"),s._t.addColorStop(1,"#600"),s.color=et;const n=tt();if(s.Nt=[[20,()=>s.bt=15,v],[40,()=>(s.At=5,s.Wt++),k],[60,()=>s.bt=10,v],[80,()=>(s.At=6,s.Wt++),k],[120,()=>s.bt=5,v],[140,()=>(s.At=7,s.Wt++),k],[200,()=>s[_t.x]=.08,F],[250,()=>(s.At=9,s.Wt++),k],[300,()=>s.Tt=1,W],[350,()=>s.yt=.08,O],[400,()=>s.bt=4,v],[450,()=>s.kt=10,T],[550,()=>s.bt=3,v],[600,()=>s[_t.x]=.1,F],[650,()=>s.kt=7,T],[750,()=>s.bt=2,v],[800,()=>s.yt=.1,O],[850,()=>s.kt=5,T],[950,()=>s.kt=4,T]],n.it){const t=[n.it,()=>s.St=1,n.Mt],e=s.Nt.findIndex(t=>t[0]>=n.it);-1===e&&s.Nt.push(t),s.Nt[e][0]==n.it?s.Nt[e]=t:s.Nt.splice(e,0,t)}i[_t.o][_t.i]("eh",()=>{s.it++,s.Nt[_t.p](([e,i,n])=>{e===s.it&&(s.level++,i(),t.tt(n))}),!s.St&&(s.it%100==0||s.it>400&&s.it%50==0)&&(s.level++,s.nt=_m.min(100,s.nt+50),t.tt(I))})}o(){const t=this,e=t._c;if(e[_t.m]=t.color,e[_t.n](0,0,60,60),t.Ct){e[_t.m]=t._t,e[_t.w]();const s=Xb(),i=Xa(2*_m.pow(t.At/2,2));H(13)[_t.p](n=>e.lineTo(15+t.width/2/12*n,59+n%2*(2*i-s*i*_m.sqrt(_m.abs(n/2-3))))),e.fill()}}h(){super.h(),this.Et[_t.p](t=>t.h())}update(t,e,s){const i=this;i.Et[_t.p]((n,h)=>{n.q<s-80||n.ht?i.Et.splice(h,1):n[_t.q](t,e)}),i.Ft=Xa(s/600),t.filter(t=>C({x:i.x,y:i.y},t)<55)[_t.p](t=>{B(),i.nt-=10,i._c[_t.o].dispatchEvent(new CustomEvent("eh",{detail:t}))});const n=i.Ct;if(i.Ct=S("w"),i.Ct&&!n?Y(i.Wt):!i.Ct&&n&&z(),S("space")){let t=0;s-i.vt>=i.bt&&(t=1,i.vt=s,i.Rt(s)),i.Tt&&s-i.It>=i.kt&&(t=1,i.It=s,i.Ut(s)),t&&q()}if(S("w")){i.Dt+=-_m.sin(i._r)*i[_t.x],i.Ht+=_m.cos(i._r)*i[_t.x];const t=E(i.Dt,i.Ht);t>i.At&&(i.Dt*=i.At/t,i.Ht*=i.At/t)}const h=i.yt/(i.Ot?1:2);S("a")?(i._r=i._r-h,i.Ot=1):S("d")?(i._r=i._r+h,i.Ot=1):this.Ot=0}Rt(t){const e=_m.sin(this._r),s=_m.cos(this._r);this.Et.push(new L({dx:10*e,dy:10*-s,x:this.x+40*e,y:this.y-40*s,_r:this._r,q:t}))}Ut(t){const e=_m.sin(this._r),s=_m.cos(this._r);this.Et.push(new L({dx:15*e,dy:15*-s,x:this.x+-5*e-30*s,y:this.y- -5*s-30*e,_r:this._r,q:t})),this.Et.push(new L({dx:15*e,dy:15*-s,x:this.x+-5*e+30*s,y:this.y- -5*s+30*e,_r:this._r,q:t}))}}class ot extends u.t{constructor(t){super(t={...t,width:40,height:40,Dt:0,Ht:0,anchor:{x:.5,y:.5}}),this.type=3*Xa(Xb()*st.length/3),this.$t=st,this.nt++,this.rt(),this.Lt()}rt(){this.nt--,this.nt>0?this.color=this.$t[this.nt-1+this.type]:this.jt()}jt(){this._c[_t.o].dispatchEvent(new CustomEvent("eh",{detail:this}))}update(t,e){const s=this,i={x:e.ot+e.x,y:e.at+e.y,ct:e.ct};let n;if(i.ct>0){const t=C(s,i)-i.ct;n={angle:b(s,i)+110,qt:t}}const h=t.reduce((t,e)=>{if(e!==s){const i=C(s,e);if(i<t.qt){return{angle:b(s,e)+180,qt:i}}}return t},{qt:100,angle:0});let r=b(s,s.Bt);n&&n.qt<100?r=(n.angle+r)/2:h.qt<100&&(r=(h.angle+r)/2),s.Dt-=.1*_m.sin(r),s.Ht+=.1*_m.cos(r);const o=E(s.Dt,s.Ht),a=s.Yt();o>a&&(s.Dt*=a/o,s.Ht*=a/o),s.dx-=s.Dt,s.dy-=s.Ht,super[_t.q]()}Yt(){return _m.min(this.Bt.Ft/8,5)+5}Lt(){const t=b(this,this.Bt),e=this.Yt();this.Dt-=_m.sin(t)*e,this.Ht+=_m.cos(t)*e}zt(){return C(this,this.Bt)}}class at extends c.t{constructor(t){super(t)}o(){const{_c:t}=this;t[_t.m]=it[_m.pow(10*this.Gt+this.Xt,2)%it.length],t[_t.w](),t.arc(this.ot,this.at,this.ct,0,2*_m.PI),t.fill()}update(t,e,s){super[_t.q]();const{width:i,height:n}=this._c[_t.o],h=(this.x||0)-i/2,r=(this.y||0)-n/2,o=2*i,a=2*n,c=Xa(h/o)+1,l=Xa(r/a)+1,u=1e4*c+l;this.Gt=c,this.Xt=l;let d=0;if(0===c&&0===l)this.ct=0;else{d=u!=1e4*c+l;const t=D(1e4*c+l);this.ct=Xa(60*t()+40),this.ot=Xa(t()*(o-4*this.ct)/2+o/4-c*o+this.ct),this.at=Xa(t()*(a-4*this.ct)/2+a/4-l*a+this.ct)}this.ct>0&&[...t,...s.Jt.Kt?[]:[e]][_t.p](t=>{const e={x:this.ot,y:this.at},s={x:t.x-this.x,y:t.y-this.y},i=C(s,e);if(i<=this.ct+30){const n={x:(s.x-e.x)/i,y:(s.y-e.y)/i},h={x:-t.Dt,y:t.Ht},r=-h.x*n.x+h.y*n.y;r>0&&(t.Dt=-r*n.x*.8,t.Ht=-r*n.y*.8),d&&t.jt()}else if(i<6*this.ct){const n=b(s,e);t.Dt+=-_m.sin(n)/50*i/150,t.Ht+=_m.cos(n)/50*i/150}})}}const{_c:ct,canvas:lt}=function(s){return t=_d.getElementById(s)||s||_d.querySelector("canvas"),e=t[_t.y]("2d"),e.Qt=0,i("init"),{canvas:t,_c:e}}(),ut={Vt:{Kt:0,text:"No Death"},Jt:{Kt:0,text:"No Gravity"}};function dt(){const t=_d.getElementsByTagName("canvas")[0];t.width=window.innerWidth,t[_t.l]=window.innerHeight}console.log(["Hello Cheater","-------------------------",...Object.keys(ut).map((t,e)=>`Press ${e+1} for ${ut[t].text}`)].join("\n")),(t=>{et=t[_t.z]((()=>{const t=_d[_t.A]("canvas"),e=t[_t.y]("2d"),s=[30,0,22.5,15,20,30,0,45,0,57,15,59,45,59,59,57,59,45,40,30,37.5,15];e[_t.m]="#000F",e[_t.n](0,0,60,60),t.width=60,t[_t.l]=60,e[_t.w](),e[_t.m]="#888";for(let t=0;t<s.length;t+=2)e.lineTo(s[t],s[t+1]);return e.fill(),e[_t.m]="#444",nt(e,40,30,50,59,80),nt(e,20,30,10,59,-20),e[_t.m]="#777",nt(e,30,5,20,50,40),e[_t.m]="#666",nt(e,30,5,20,40,40),e[_t.m]="#222",nt(e,30,15,25,35,35),e[_t.m]="#AAA",H(4)[_t.p](t=>{nt(e,10*t+15,50,10*t+10,59,10*t+20)}),t})(),null),H(15).reduce((t,e)=>[...t,...["#080","#00f","#d00"].map(t=>((t,e)=>{const s=_d[_t.A]("canvas"),i=s[_t.y]("2d");s.width=30,s[_t.l]=30,i[_t.m]=t,i[_t.n](0,0,30,30);const n=D(e+1);for(let t=0,e=0;e<30;){const s=Xa(7*n()+2);i[_t.m]=n()<.5?"#333":"#222",i[_t.n](t,e,s,Xa(7*n()+2)),t+=1+s,t>30&&(e+=5,t=0)}const h=i[_t.z](s,null);s.width=40,s[_t.l]=40,i[_t.m]="#0000",i[_t.n](0,0,40,40),i[_t.m]=h;for(let t=0;t<10;t++)i[_t.w](),i.rect(t,t/2,30,30),i.strokeWidth=1,i.strokeStyle="#0008",i.fill(),i.stroke();return s})(t,e))],[]).map(e=>t[_t.z](e,null))[_t.p](t=>st.push(t)),H(50).map(t=>(t=>{const e=_d[_t.A]("canvas"),s=e[_t.y]("2d");e.width=300,e[_t.l]=300,s[_t.m]="#b7b6b4",s[_t.n](0,0,300,300);const i=D(t+1);return H(40)[_t.p](()=>{s[_t.m]=ht[Xa(i()*ht.length)];const[t,e,n,h]=H(8).map(()=>Xa(250*i()+50)),[r,o,a,c]=H(8).map(()=>Xa(50*i()+10));s.moveTo(t,e),s.bezierCurveTo(t+r,e+o,n+a,h+c,n,h),s.moveTo(n,h),s.bezierCurveTo(n-r,h-o,t-a,e-c,t,e),s.fill()}),e})(t)).map(e=>t[_t.z](e,null))[_t.p](t=>it.push(t))})(ct),_a("resize",dt,0),dt(),function(){let t;for(t=0;t<26;t++)M[t+65]=M["Key"+String.fromCharCode(t+65)]=String.fromCharCode(t+97);for(t=0;t<10;t++)M[48+t]=M["Digit"+t]=""+t;_a("keydown",y),_a("keyup",m),_a("blur",A)}();let ft=new p({color:_t.h,font:"70px Arial",textAlign:_t.d,text:"Lost In Space",x:lt.width/2,y:lt[_t.l]/4}),pt=new p({color:_t.h,font:_t.c,textAlign:_t.d,text:"Endless Destruction",x:lt.width/2,y:lt[_t.l]/4+90});const wt=new p({font:_t.e,color:_t.b,text:"Paused",textAlign:_t.d});let xt,gt,Mt,yt,mt,At,St,Ct,Et;const bt=()=>{xt=1,gt=null,Mt=new $,yt=new R,At=new rt(Mt),Et=0,Ct=1,St=[],mt=new at;tt().gt[_t.p](t=>Mt.tt(t,_m.max(t.split(" ").length,6)/150*6e4))};bt();let vt=0;const Tt=function({Zt:t=60,te:e=1,update:s=h,h:r,_c:o=n()}={}){let a,c,l,u,d,f=0,p=1e3/t,x=1/t,g=e?w:h;function M(){if(c=requestAnimationFrame(M),l=performance.now(),u=l-a,a=l,!(u>1e3)){for(i("tick"),f+=u;f>=p;)d[_t.q](x),f-=p;g(o),d.h()}}return d={update:s,h:r,ee:1,start(){a=performance.now(),this.ee=0,requestAnimationFrame(M)},stop(){this.ee=1,cancelAnimationFrame(c)}},d}({te:0,update:()=>{Object.keys(ut).map((t,e)=>{N((e+1).toString())&&(ut[t].Kt=!ut[t].Kt,Mt.tt(ut[t].text+(ut[t].Kt?" On":" Off"),2e3))}),gt?(Mt[_t.q](At),gt[_t.q](),S("enter")&&bt()):xt||(()=>{if(N("esc")&&(Et=!Et),Ct%_m.max(3*(30-At.Ft),30)==0){const[t,e]=P(lt),s=_m.max(2*_m.min((At.Ft-3)/20,1),0)+1;St.push(new ot({x:t,y:e,Bt:At,nt:Xa(_m.pow(Xb(),2)*s+1)}))}Mt[_t.q](At),Et||(Ct++,At[_t.q](St,mt,Ct),yt.dx=At.Dt,yt.dy=At.Ht,yt[_t.q](Ct),mt.dx=At.Dt,mt.dy=At.Ht,mt[_t.q](St,At,ut),St[_t.p](t=>{t.dx=At.Dt,t.dy=At.Ht,t[_t.q](St,mt)}),St.length>50&&St.splice(St.reduce((t,e,s)=>{const i=e.zt();return t.max<i?{max:i,se:s}:t},{max:0,se:-1}).se,1),At.St&&!vt&&(vt=1,yt.j(0),_s(()=>{St=[],yt.j(1),vt=0,gt||(gt=new J(At,1))},5e3)))})(),At.x=lt.width/2,At.y=lt[_t.l]/2,wt.x=At.x,wt.y=At.y,ft&&(ft.x=lt.width/2,ft.y=lt[_t.l]/4),pt&&(pt.x=lt.width/2,pt.y=lt[_t.l]/4+90)},h:()=>{yt.h(),mt.h(),St[_t.p](t=>t.h()),At.h(),Mt.h(),Et?wt.h():gt?gt.h():xt&&(0===Mt.B.length&&(xt=0),Mt.Z(xt),N("space")&&Mt.et(),Mt[_t.q](At)),ft&&ft.h(),pt&&pt.h()}});lt[_t.i]("eh",({detail:t})=>{St.splice(St.indexOf(t),1),At.nt<=0&&!ut.Vt.Kt&&(gt=new J(At,0))}),Tt.start(),_s(()=>{ft=null,pt=null},6e3);};lis();</script></body></html>