html 太空入侵者

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 太空入侵者相关的知识,希望对你有一定的参考价值。

<body><script>eval('!function(t,i,s,h,n,o,e,a,r){function f(){var t=this.contro\
ls,i=this.id=this.id||(1e17*Math.random()).toString(32);this.I=function(s){for(\
var h in t)s.which===t[h]&&dispatchEvent(new Event(h+i))},this.A()}function p(t\
){return function(){var i,s=this.controls,h=this.id;for(i in s)t(i+h,this[i].bi\
nd(this));t(\"keydown\",this.I)}}function l(i){this.h=this.g=0,s(this,i),this.x\
=this.g,this.y=this.h,this.path=new t(this.d),f.apply(this,arguments),this.move\
To()}function u(){l.apply(this,arguments)}function d(){clearInterval(this.m),th\
is.i()}function y(){l.apply(this,arguments)}function v(){l.apply(this,arguments\
),this.o()}function b(t){var c=i.body.appendChild(i.createElement(\"canvas\"));\
s(this,t),c.height=1.5*(c.width=170),this.a=[],this.b=c.getContext(\"2d\"),f.ap\
ply(this,arguments),this.start()}return t.prototype.u=function(i){return functi\
on(s,h){return\"string\"==typeof s?new t(s.replace(/M(\\d+)[\\s,](\\d+)/,\"M\"+\
(h.e||\"$1\")+\" \"+(h.C||\"$2\"))):i.apply(this,arguments)}}(t.prototype.u),f.\
prototype={A:p(n),G:p(o)},l.prototype=s({},f.prototype,{collapse:function(t){t.\
j(\"crashed by \"+this.id),this.j(\"crashed into \"+t.id)},l:h,moveTo:function(\
i,s){var h=this.b,n=this.f,o=this.c,a=typeof this.x===e?this.g:this.x,r=typeof \
this.y===e?this.h:this.y;i=typeof i===e?a:i,s=typeof s===e?r:s,h.clearRect(this\
.x,this.y,this.f,this.c),this.L||(0>=i||i+n>h.canvas.width||0>=s||s+o>h.canvas.\
height?this.l():this.w&&this.w(i,s)||(this.x=i,this.y=s,this.J=this.x+~~(this.f\
/2),this.K=this.y+~~(this.c/2),this.path=(new t).u(this.d,{e:this.x,C:this.y+th\
is.c}),requestAnimationFrame(this.B.bind(this))))},left:function(){this.moveTo(\
this.x-this.step,this.y)},right:function(){this.moveTo(this.x+this.step,this.y)\
},s:function(){this.moveTo(this.x,this.y-this.step)},v:function(){this.moveTo(t\
his.x,this.y+this.step)},B:function(){var i=this.b;i.fillStyle=this.color,i.fil\
l(new t(this.path))},w:function(){var t=this.b;return this.a?this.a.some(functi\
on(i){this.id!==i.id&&t.isPointInPath(i.path,this.J,this.K)&&this.collapse(i)}.\
bind(this)):void 0},j:function(){this.F--?this.moveTo(this.g,this.h):(this.i(),\
alert(this.id+r))},i:function(){this.b.clearRect(this.x,this.y,this.f,this.c),t\
his.a.splice(this.a.indexOf(this),1),this.G()}}),u.prototype=s({},l.prototype,{\
D:function(){var t;t=new v({b:this.b,controls:{s:56,v:50},g:this.x+~~(this.f/2)\
,h:this.y-this.c,a:this.a}),this.a.push(t)},f:15,c:15,step:2,d:\"M0 0l1 -7l2 2l\
3 -3l1 -5l1 0l1 5l3 3l2 -2l1 6l-6 -2l-1 1l-1 0l-1 -1l-4 2Z\"},u),y.prototype=s(\
{},l.prototype,{j:function(){var t=this.a.filter(function(t){return t instanceo\
f y}).length;clearInterval(this.m),this.i(),t||alert(r)},l:d,round:function(){}\
,o:function(){this.m=a(this.round.bind(this),1e3)},d:\"M0 0m8 -8a 4 4 0 1 0 1 0\
Z\",f:16,c:8},y),v.prototype=s({},l.prototype,{j:d,l:d,o:function(){this.m=a(th\
is.s.bind(this),50)},f:2,c:3,step:6,d:\"M0 0l1 0l0 -2l-1 0\"},v),b.prototype=s(\
{},f.prototype,{start:function(){var t=this.b,i=t.canvas,i=new u({b:t,F:3,contr\
ols:{left:37,right:39,s:38,v:40,D:32},g:i.width/2-7,h:i.height-32,a:this.a});th\
is.a.push(i),[[20,20],[52,20],[84,20],[116,20],[148,20],[36,40],[68,40],[100,40\
],[130,40],[20,60],[52,60],[84,60],[116,60],[148,60]].forEach(function(i){i=new\
 y({b:t,g:i[0],h:i[1],a:this.a}),this.a.push(i),i.o()}.bind(this))},end:functio\
n(){this.a.forEach(function(t){t.i()})},H:function(){this.end(),this.start()}})\
,new b({id:\"SpaceInvaders\",controls:{start:13,end:27,H:82}})}(Path2D,document\
,Object.assign,function(){},addEventListener,removeEventListener,\"undefined\",\
setInterval,\"game over\");')</script><a href="http://arturs.jansons.net">iegik

以上是关于html 太空入侵者的主要内容,如果未能解决你的问题,请参考以下文章

用于太空入侵者 RL (Keras) 的 LSTM 网络

如何在 xcode spritekit 中快速保持太空游戏中入侵者的节点数稳定?

如何用Sprite Kit制作《太空入侵者》

太空侵略者项目

使用python类(OOP)创建FUNCTIONAL龟对象?

求1部人们开飞船去外太空杀怪物的电影