贪吃蛇
来源:互联网 发布:mac按键精灵怎么用 编辑:程序博客网 时间:2024/04/30 14:00
<!doctype html><html><body><canvas id="can" width="400" height="400" style="background:Black"></canvas><script> var sn=[42,41],dz=43,fx=1,n,ctx=document.getElementById("can").getContext("2d"); function draw(t,c){ ctx.fillStyle=c; ctx.fillRect(t%20*20+1,~~(t/20)*20+1,18,18); } document.onkeydown=function(e){fx=sn[1]-sn[0]==(n=[-1,-20,1,20][(e||event).keyCode-37]||fx)?fx:n}; !function(){ sn.unshift(n=sn[0]+fx); if(sn.indexOf(n,1)>0 || n<0||n>399||fx==1&&n%20==0||fx==-1&&n%20==19) return alert("GAME OVER"); draw(n,"Lime"); if(n==dz){ while(sn.indexOf(dz=~~(Math.random()*400))>=0); draw(dz,"Yellow"); }else draw(sn.pop(),"Black"); setTimeout(arguments.callee,130); }();</script></body></html>
0 0
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 贪吃蛇
- 开发,学习,养成做笔记的习惯
- a毛 jquery 学习记 4过滤选择器2
- PHP获取指定月份的月初月尾时间
- XAMPP 安装 LDAP
- 人工智能短故事:认知非连续Short Story on AI: A Cognitive Discontinuity
- 贪吃蛇
- 原型模式
- Eclipse开发前,常用设置
- 如何在Windows下,python3.5.1下安装BeautifuSoup。
- 循环神经网络The Unreasonable Effectiveness of Recurrent Neural Networks
- 编程小练习
- picker View控件使用
- 广东工业大学2016校赛决赛Problem BSward Art Online(分组背包)
- iOS AFN 做缓存(如何简单的做缓存)