javascript编码规范怎么编游戏?

JavaScript编写一个贪吃蛇游戏
作者:欧阳翠花
字体:[ ] 类型:转载 时间:
本文主要介绍了JavaScript写的一个贪吃蛇游戏的实例,具有很好的参考价值。下面跟着小编一起来看下吧
写的比较乱,有个逻辑错误:蛇吃了果果后应该是蛇尾加一节,写成了蛇头部增加一节- -。
可用键盘的上下左右键操作;
代码如下:
&style type="text/css"&
body{margin:0;padding:0;-webkit-user-select:-moz-user-select:-ms-user-select:user-select:-webkit-user-select:
-moz-user-select:
-ms-user-select:
user-select:}
table{border-collapse:width:500px}
td{border:1width:20height:20}
#wrap{width:500height:500background-color:#8B8386;margin:0position:border:1px solid #8B2500;}
#tar{width:20height:20position:background-color:#FFEE26;}
.num{width:20height:20background-color:#FDFF68;border:1border-radius:50%;position:}
input{color:font-size:20font-weight:position:display:width:60height:35}
#btn2{top:45left:0}
#btn4{top:90left:70}
#btn1{top:45left:140}
#btn3{top:0left:70}
#btn{position:background-color:width:200height:125}
#txt{width:80height:55background-color:position:left:60top:35color:font-size:16font-weight:line-height:55text-align:cursor:}
&div id="btn" style="left:520top:20px"&
&input type="button" value="→" id="btn1"/&
&input type="button" value="←" id="btn2"/&
&input type="button" value="↑" id="btn3"/&
&input type="button" value="↓" id="btn4"/&
&div id="txt"&点此拖动&/div&
&div id="wrap" style="left:20top:20px"&
&div id="tar"&&/div&
&tbody id="tb"&
&div class="num"&&/div&
&div class="num"&&/div&
&div class="num"&&/div&
&div class="num"&&/div&
&div class="num"&&/div&
&script type="text/javascript"&
var tb=document.getElementById('tb');
var wrap=document.getElementById('wrap');
var tr=new Array();
var td=new Array();
for(var i=0;i&25;i++)
//绘制地图
tr[i]=document.createElement('tr');
tb.appendChild(tr[i]);
for(var j=0;j&25;j++)
td[j]=document.createElement('td');
tr[i].appendChild(td[j]);
var tar=document.getElementById('tar');
//食物定位
function food()
a=Math.random()*460;
a=Math.floor(a/20)*20+20;
b=Math.random()*460;
b=Math.floor(b/20)*20+20;
tar.style.left=a+"px";
tar.style.top=b+"px";
var s=document.getElementsByClassName('num'); //定位蛇的位置
s[0].style.backgroundColor="#3EFF1A";
var x=300,y=400,f,d,p,Fraction=0,t=600,tt=60;
for(var k=0;k&s.k++)
s[k].style.left=x+"px";
s[k].style.top=y+20*k+"px";
function move(obj,direction)
//控制移动函数开始
clearTimeout(d);
s=document.getElementsByClassName('num');
var l=new Array();
l[0]=s[0].style.
var w=new Array();
w[0]=s[0].style.
//移动方向
s[0].style.left=x+"px";
s[0].style.top=y+"px";
for(var k1=1;k1&s.k1++)
l[k1]=s[k1].style.
w[k1]=s[k1].style.
s[k1].style.left=l[k1-1];
s[k1].style.top=w[k1-1];
if(parseInt(s[0].style.left)==parseInt(tar.style.left)&&parseInt(s[0].style.top)==parseInt(tar.style.top))
if(tt==0)tt=5;
var new_div=document.createElement('div');
new_div.className="num";
Fraction+=100;
new_div.style.top=s[0].style.
new_div.style.left=parseInt(s[0].style.left)+20+"px";
new_div.style.top=s[0].style.
new_div.style.left=parseInt(s[0].style.left)-20+"px";
new_div.style.left=s[0].style.
new_div.style.top=parseInt(s[0].style.top)-20+"px";
new_div.style.left=s[0].style.
new_div.style.top=parseInt(s[0].style.top)+20+"px";
s[0].parentNode.insertBefore(new_div,s[0]);
s[0].style.backgroundColor="#3EFF1A";
for(var k=1;k&s.k++)
s[k].style.backgroundColor="#FDFF68";
if(parseInt(s[0].style.left)&0||parseInt(s[0].style.left)&=500||parseInt(s[0].style.top)&0||parseInt(s[0].style.top)&=500)
alert("GAME OVER!"+"你的分数为:"+Fraction+"分");
for(var k=0;k&5;k++)
s[k].style.left=x+"px";
s[k].style.top=y+20*k+"px";
for(var kk=s.length-1;kk&4;kk--)
s[kk].parentNode.removeChild(s[kk]);
for(k=1;k&s.k++)
if(parseInt(s[0].style.left)==parseInt(s[k].style.left)&&parseInt(s[0].style.top)==parseInt(s[k].style.top))
alert("GAME OVER!"+"你的分数为:"+Fraction+"分");
for(var k=0;k&5;k++)
s[k].style.left=x+"px";
s[k].style.top=y+20*k+"px";
for(var kk=s.length-1;kk&4;kk--)
s[kk].parentNode.removeChild(s[kk]);
d=setTimeout(direction,t);
document.getElementById('btn1').onclick=function R() //绑定鼠标点击事件
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.left)&parseInt(s[1].style.left))
move(x=x+20,R);
document.getElementById('btn2').onclick=function L()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.left)&parseInt(s[1].style.left))
move(x=x-20,L);
document.getElementById('btn3').onclick=function T()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.top)&parseInt(s[1].style.top))
move(y=y-20,T);
document.getElementById('btn4').onclick=function B()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.top)&parseInt(s[1].style.top))
move(y=y+20,B);
document.onkeydown=function(event)
//绑定键盘事件
var e=event||window.
if(e&&e.keyCode==39)
function R()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.left)&parseInt(s[1].style.left))
move(x=x+20,R);
if(e&&e.keyCode==37)
function L()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.left)&parseInt(s[1].style.left))
move(x=x-20,L);
if(e&&e.keyCode==38)
function T()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.top)&parseInt(s[1].style.top))
move(y=y-20,T);
if(e&&e.keyCode==40)
function B()
x=parseInt(s[0].style.left);
y=parseInt(s[0].style.top);
if(parseInt(s[0].style.top)&parseInt(s[1].style.top))
move(y=y+20,B);
var btn=document.getElementById('btn');
var btn_l,btn_t;
function btn_move()
btn_l=clientX-parseInt(wrap.style.left)
confirm("可用键盘的上下左右四个按键进行游戏操作!")
var btn=document.getElementById('btn');
//开始制作操作区拖动效果
var txt=document.getElementById('txt');
var new_x,new_y,bool=
txt.onmousedown=function ()
var eve=event||window.
new_x=eve.clientX-parseInt(btn.style.left);
new_y=eve.clientY-parseInt(btn.style.top);
btn.onmousemove=function btn_move(event)
var e=event||window.
btn.style.left=e.clientX-new_x;
btn.style.top=e.clientY-new_y;
if(parseInt(btn.style.left)&520)btn.style.left="520px";
if(parseInt(btn.style.top)&0)btn.style.top="0px";
if(parseInt(btn.style.top)&395)btn.style.top="395px";
document.body.onmouseup=function()
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具制作一个 JavaScript 小游戏 - 知乎专栏
{"debug":false,"apiRoot":"","paySDK":"/api/js","wechatConfigAPI":"/api/wechat/jssdkconfig","name":"production","instance":"column","tokens":{"X-XSRF-TOKEN":null,"X-UDID":null,"Authorization":"oauth c3cef7c66aa9e6a1e3160e20"}}
{"database":{"Post":{"":{"title":"制作一个 JavaScript 小游戏","author":"hev1n","content":"作者学习了编程两个月,边学边做了一个 JavaScript 小游戏,在文中总结了自己在这个过程中的一些体会,希望能给其他初学者一些帮助。对于很多想学编程但一直没下定决心的同学来说,最大的问题可能就是没有一个切实可行的计划。这里作者将自己要完成游戏的这件事划分成了很多小任务,比如:先构思要做一个怎样的游戏,解谜?角色扮演?考虑不同类型游戏需要有什么样的要素。写下所有需要编程完成的事,对于作者的这个游戏来说就是:界面一个技能系统一个事件系统角色状态系统保存功能寻找好的游戏美术资源::里面的图标简单但看起来很不错。:免费的游戏资源,不只包含美术资源,还有音频等等的资源。:一个帮助制作小图标的在线工具。:制作 CSS Sprite 的在线工具。开始编程完成游戏。解决发现的 bug。当然实际做起来要复杂得多,作者在文中也谈到了自己的遇到的问题和解决办法,并开源了自己的代码,感兴趣的可以去原文详细看看。: )项目地址:原文:","updated":"T16:11:16.000Z","canComment":false,"commentPermission":"anyone","commentCount":29,"collapsedCount":0,"likeCount":416,"state":"published","isLiked":false,"slug":"","isTitleImageFullScreen":false,"rating":"none","titleImage":"/bcfa42438dde6629fcb51_r.png","links":{"comments":"/api/posts//comments"},"reviewers":[],"topics":[{"url":"/topic/","id":"","name":"游戏开发"},{"url":"/topic/","id":"","name":"JavaScript"},{"url":"/topic/","id":"","name":"编程"}],"adminClosedComment":false,"titleImageSize":{"width":1200,"height":582},"href":"/api/posts/","excerptTitle":"","column":{"slug":"jiguang-daily","name":"极光日报"},"tipjarState":"inactivated","annotationAction":[],"sourceUrl":"","pageCommentsCount":29,"hasPublishingDraft":false,"snapshotUrl":"","publishedTime":"T00:11:16+08:00","url":"/p/","lastestLikers":[{"bio":null,"isFollowing":false,"hash":"b5aa317e1bcde5ad0e5c2e","uid":843000,"isOrg":false,"slug":"yao-wan-44-94","isFollowed":false,"description":"","name":"药丸","profileUrl":"/people/yao-wan-44-94","avatar":{"id":"b30cebeb94e904ee0af958b9bd8efe0c","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false},{"bio":"学生","isFollowing":false,"hash":"4ae5ca27d9c2f192c7f92d02c001ad68","uid":544700,"isOrg":false,"slug":"sss-21-53","isFollowed":false,"description":"","name":"请叫我李纯洁","profileUrl":"/people/sss-21-53","avatar":{"id":"v2-e4f62e330d71c8d79dc3","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false},{"bio":"幻想本无形,吾等形之","isFollowing":false,"hash":"c9e7d31b1e5fc7aba17fb0bd88ca591c","uid":743000,"isOrg":false,"slug":"wang-xiao-jian-48-30","isFollowed":false,"description":"混蛋一个","name":"王小贱","profileUrl":"/people/wang-xiao-jian-48-30","avatar":{"id":"faa60ab67f584c80ed87","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false},{"bio":"什么都不是","isFollowing":false,"hash":"c103f41d1e2d29a5ad3002f1dbe3383a","uid":346900,"isOrg":false,"slug":"mou-mou-23-7","isFollowed":false,"description":"","name":"某某","profileUrl":"/people/mou-mou-23-7","avatar":{"id":"1ca8dce8de","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false},{"bio":"乘风破浪会有时","isFollowing":false,"hash":"f6f9f22ecc","uid":469800,"isOrg":false,"slug":"mei-pi-gu-de-hu-li-cc","isFollowed":false,"description":"言简意赅","name":"没屁股的狐狸Cc","profileUrl":"/people/mei-pi-gu-de-hu-li-cc","avatar":{"id":"a26c720c74fd533bbe1ec268a4d6b3f7","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false}],"summary":"作者学习了编程两个月,边学边做了一个 JavaScript 小游戏,在文中总结了自己在这个过程中的一些体会,希望能给其他初学者一些帮助。对于很多想学编程但一直没下定决心的同学来说,最大的问题可能就是没有一个切实可行的计划。这里作者将自己要完成游戏的这…","reviewingCommentsCount":0,"meta":{"previous":{"isTitleImageFullScreen":false,"rating":"none","titleImage":"/e5e830feec42bfe69b60ea_r.jpg","links":{"comments":"/api/posts//comments"},"topics":[{"url":"/topic/","id":"","name":"方法论"},{"url":"/topic/","id":"","name":"GitHub"},{"url":"/topic/","id":"","name":"Evernote"}],"adminClosedComment":false,"href":"/api/posts/","excerptTitle":"","author":{"bio":"搬运工","isFollowing":false,"hash":"fd2c36fe6bfd4ed032b3ee","uid":804200,"isOrg":false,"slug":"McDoge","isFollowed":false,"description":"弱小和无知不是生存的障碍,傲慢才是。| 别做梦了,做事儿。 | 某非知名大号被封后的第N个小号 | 我已委托“维权骑士”()为我的文章进行维权行动","name":"园长","profileUrl":"/people/McDoge","avatar":{"id":"v2-e735dbd7f2cb14d1dc91614ad3fba367","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false},"column":{"slug":"jiguang-daily","name":"极光日报"},"content":"极光日报祝各位同学中秋快乐!Evernote 正在把它的全部数据与机器学习技术迁移到 Google 云平台上简评:这个新闻有标志性意义,说明即使是有比较大数据量的公司,也开始采用大的云平台,来节省成本,同时运用其开放的高级 API。这会是个趋势。最终只会有几个非常大的云平台存在,计算资源就像我们现在用电一样。来看看今年的 Github Universe简评: 是 Github 自去年开始举办的线下交流活动。今年将会有超过 50 名演讲者,都是来自于 Github、Travis CI、Google、Adobe、Facebook、Slack、IBM 等知名公司的从业者。并会有超过 1400 位来自世界各地的参与者。如何投资自己(可行方法论:附赠工具表格)简评:投资自己是最大的投资,但是如何做呢?本文是一片强大的方法论文章,文末附赠园长做的工具表格。欢迎关注知乎专栏「极光日报」,每日 3 篇优质英文文章。微信公众号「极光开发者」(jiguangdev),每周 2 篇技术类文章。","state":"published","sourceUrl":"","pageCommentsCount":0,"canComment":false,"snapshotUrl":"","slug":,"publishedTime":"T17:54:20+08:00","url":"/p/","title":"极光日报 第31期()","summary":"极光日报祝各位同学中秋快乐! Evernote 正在把它的全部数据与机器学习技术迁移到 Google 云平台上简评:这个新闻有标志性意义,说明即使是有比较大数据量的公司,也开始采用大的云平台,来节省成本,同时运用其开放的高级 API。这会是个趋势。最终只会有几…","reviewingCommentsCount":0,"meta":{"previous":null,"next":null},"commentPermission":"anyone","commentsCount":0,"likesCount":1},"next":{"isTitleImageFullScreen":false,"rating":"none","titleImage":"/46dbc472f3ed195bf61fb4_r.jpg","links":{"comments":"/api/posts//comments"},"topics":[{"url":"/topic/","id":"","name":"设计"},{"url":"/topic/","id":"","name":"侘寂(Wabi-sabi)"},{"url":"/topic/","id":"","name":"哲学"}],"adminClosedComment":false,"href":"/api/posts/","excerptTitle":"","author":{"bio":"搬运工","isFollowing":false,"hash":"fd2c36fe6bfd4ed032b3ee","uid":804200,"isOrg":false,"slug":"McDoge","isFollowed":false,"description":"弱小和无知不是生存的障碍,傲慢才是。| 别做梦了,做事儿。 | 某非知名大号被封后的第N个小号 | 我已委托“维权骑士”()为我的文章进行维权行动","name":"园长","profileUrl":"/people/McDoge","avatar":{"id":"v2-e735dbd7f2cb14d1dc91614ad3fba367","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false},"column":{"slug":"jiguang-daily","name":"极光日报"},"content":"简评:人都会犯错,但是在时间的长河里,它只是一瞬,继续走,带着错误往前,它本身就是生命的一部分。纳瓦霍地毯是现在时尚界热单品。源于古老的印第安手工艺,由家里的母亲传给女儿,绝不外传。作者去拜访了一位专营纳瓦霍地毯地毯的印第安老商人。看到店里许多地毯上的图案有瑕疵或者说错误。作者提出疑惑,问老先生:为何地摊上有这么多错误的图案?老先生回答:正是这些错误才让纳瓦霍地毯受欢迎,这种错误能时刻提醒着人们,我们是不完美的。你可以在日本的 wabi - sabi()文化中找到类似的情感。纳瓦霍人把错误当做一种警示。既然你不能改变时间,为什么要改变已经发生的错误?这个错误在此时已经被编织在织物上了。当你回头看时,这是很好的提醒。就像登山一样,你一定会走错一些路,但是不要停下来,接着走,哪怕绕一些弯子也不要停,最终你会到达山顶。错路也是登山的一部分。文章编译自:(900K,预计三分钟阅读完)欢迎关注知乎专栏「极光日报」,每日 4 篇优质英文文章。微信公众号「极光开发者」(jiguangdev),每周 2 篇技术类文章。","state":"published","sourceUrl":"","pageCommentsCount":0,"canComment":false,"snapshotUrl":"","slug":,"publishedTime":"T10:25:01+08:00","url":"/p/","title":"错误只是时间的一瞬","summary":"简评:人都会犯错,但是在时间的长河里,它只是一瞬,继续走,带着错误往前,它本身就是生命的一部分。纳瓦霍地毯是现在时尚界热单品。源于古老的印第安手工艺,由家里的母亲传给女儿,绝不外传。作者去拜访了一位专营纳瓦霍地毯地毯的印第安老商人。看到店…","reviewingCommentsCount":0,"meta":{"previous":null,"next":null},"commentPermission":"anyone","commentsCount":1,"likesCount":11}},"annotationDetail":null,"commentsCount":29,"likesCount":416,"FULLINFO":true}},"User":{"hev1n":{"isFollowed":false,"name":"Hevin","headline":"我已委托“维权骑士”()为我的文章进行维权行动\nViolence is the last refuge of the incompetent.\nMail: \nGithub / WeChat: lhw5123","avatarUrl":"/da575e9e315b9c80e429acdbfba3ac01_s.jpg","isFollowing":false,"type":"people","slug":"hev1n","bio":"Still waters run deep.","hash":"e6c93c614b","uid":44,"isOrg":false,"description":"我已委托“维权骑士”()为我的文章进行维权行动\nViolence is the last refuge of the incompetent.\nMail: \nGithub / WeChat: lhw5123","profileUrl":"/people/hev1n","avatar":{"id":"da575e9e315b9c80e429acdbfba3ac01","template":"/{id}_{size}.jpg"},"isOrgWhiteList":false,"badge":{"identity":null,"bestAnswerer":null}}},"Comment":{},"favlists":{}},"me":{},"global":{},"columns":{"jiguang-daily":{"following":false,"canManage":false,"href":"/api/columns/jiguang-daily","name":"极光日报","creator":{"slug":"javenfang"},"url":"/jiguang-daily","slug":"jiguang-daily","avatar":{"id":"4ccdd","template":"/{id}_{size}.jpeg"}}},"columnPosts":{},"columnSettings":{"colomnAuthor":[],"uploadAvatarDetails":"","contributeRequests":[],"contributeRequestsTotalCount":0,"inviteAuthor":""},"postComments":{},"postReviewComments":{"comments":[],"newComments":[],"hasMore":true},"favlistsByUser":{},"favlistRelations":{},"promotions":{},"switches":{"couldAddVideo":false},"draft":{"titleImage":"","titleImageSize":{},"isTitleImageFullScreen":false,"canTitleImageFullScreen":false,"title":"","titleImageUploading":false,"error":"","content":"","draftLoading":false,"globalLoading":false,"pendingVideo":{"resource":null,"error":null}},"drafts":{"draftsList":[],"next":{}},"config":{"userNotBindPhoneTipString":{}},"recommendPosts":{"articleRecommendations":[],"columnRecommendations":[]},"env":{"isAppView":false,"appViewConfig":{"content_padding_top":128,"content_padding_bottom":56,"content_padding_left":16,"content_padding_right":16,"title_font_size":22,"body_font_size":16,"is_dark_theme":false,"can_auto_load_image":true,"app_info":"OS=iOS"},"isApp":false},"sys":{}}65行 JavaScript 代码实现 Flappy Bird 游戏 - 文章 - 伯乐在线
& 65行 JavaScript 代码实现 Flappy Bird 游戏
Flappy Bird 无疑是2014年全世界最受关注的一款游戏。这款游戏是一位来自越南河内的独立游戏开发者阮哈东开发,形式简易但难度极高的休闲游戏,很容易让人上瘾。
这里给大家分享一篇这款游戏的 HTML5 版制作教程,借助
框架,只需65行 JavaScript 代码即可实现。
可能感兴趣的话题
8分不能再高了
关于伯乐在线博客
在这个信息爆炸的时代,人们已然被大量、快速并且简短的信息所包围。然而,我们相信:过多“快餐”式的阅读只会令人“虚胖”,缺乏实质的内涵。伯乐在线内容团队正试图以我们微薄的力量,把优秀的原创文章和译文分享给读者,为“快餐”添加一些“营养”元素。
新浪微博:
推荐微信号
(加好友请注明来意)
– 好的话题、有启发的回复、值得信赖的圈子
– 分享和发现有价值的内容与观点
– 为IT单身男女服务的征婚传播平台
– 优秀的工具资源导航
– 翻译传播优秀的外文文章
– 国内外的精选文章
– UI,网页,交互和用户体验
– 专注iOS技术分享
– 专注Android技术分享
– JavaScript, HTML5, CSS
– 专注Java技术分享
– 专注Python技术分享
& 2017 伯乐在线49722人阅读
前端技术(9)
Ajax/Jquery/js/ext/dwr(33)
原创整理不易,转载请注明出处:
代码下载地址:
直接上效果图:
通过左右下控制方向,上改变形状。
&!doctype html&&html&&head&&/head&&body&
&div id=&box& style=&width:252font:25px/25px 宋体;background:#000;color:#9f9;border:#999 20text-shadow:2px 3px 1px #0f0;&&&/div&
var domain=&&;
var author=&zuidaima&;
var map=eval(&[&+Array(23).join(&0x801,&)+&0xfff]&);
var tatris=[[0x6600],[0x],[0xc600,0x2640],[0x6c00,0x4620],[0xe0,0x],[0x,0x0],[0x,0x0]];
var keycom={&38&:&rotate(1)&,&40&:&down()&,&37&:&move(2,1)&,&39&:&move(0.5,-1)&};
var dia, pos, bak,
function start(){
dia=tatris[~~(Math.random()*7)];
bak=pos={fk:[],y:0,x:4,s:~~(Math.random()*4)};
rotate(0);
function over(){
document.onkeydown=
clearInterval(run);
alert(&GAME OVER&);
function update(t){
bak={fk:pos.fk.slice(0),y:pos.y,x:pos.x,s:pos.s};
for(var i=0,a2=&&; i&22; i++)
a2+=map[i].toString(2).slice(1,-1)+&&br/&&;
for(var i=0,n; i&4; i++)
if(/([^0]+)/.test(bak.fk[i].toString(2).replace(/1/g,&\u25a1&)))
a2=a2.substr(0,n=(bak.y+i+1)*15-RegExp.$_.length-4)+RegExp.$1+a2.slice(n+RegExp.$1.length);
document.getElementById(&box&).innerHTML=a2.replace(/1/g,&\u25a0&).replace(/0/g,&\u3000&);
function is(){
for(var i=0; i&4; i++)
if((pos.fk[i]&map[pos.y+i])!=0) return pos=
function rotate(r){
var f=dia[pos.s=(pos.s+r)%dia.length];
for(var i=0; i&4; i++)
pos.fk[i]=(f&&(12-i*4)&15)&&pos.x;
update(is());
function down(){
++pos.y;
for(var i=0; i&4 && pos.y+i&22; i++)
if((map[pos.y+i]|=pos.fk[i])==0xfff)
map.splice(pos.y+i,1), map.unshift(0x801);
if(map[1]!=0x801) return over();
function move(t,k){
pos.x+=k;
for(var i=0; i&4; i++)
pos.fk[i]*=t;
update(is());
document.onkeydown=function(e){
eval(keycom[(e?e:event).keyCode]);
run=setInterval(&down()&,400);
&/script&&/body&&/html&
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:3699824次
积分:35495
积分:35495
排名:第122名
原创:665篇
转载:89篇
评论:1244条
阅读:69200
(1)(2)(1)(9)(2)(12)(18)(19)(13)(28)(29)(28)(31)(29)(2)(1)(2)(1)(2)(9)(5)(31)(30)(31)(31)(33)(26)(22)(1)(1)(3)(2)(1)(2)(1)(6)(30)(11)(3)(3)(11)(7)(11)(14)(1)(16)(43)(15)(71)(54)

我要回帖

更多关于 javascript异步编程 的文章

 

随机推荐