色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

程序員web前端-java-網頁制作-20行代碼怎樣編輯貪吃蛇小游戲?

錢浩然2年前14瀏覽0評論

<!doctypehtml>

<html>

<body>

<canvasid="can"width="400"height="400"style="background:Black"></canvas>

<script>

varsn=[42,41],dz=43,fx=1,n,ctx=document.getElementById("can").getContext("2d");

functiondraw(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)

returnalert("GAMEOVER");

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>