TypechoJoeTheme

Dcr163的博客

统计

JS消灭黑块小游戏,不能点击白色的白块

2019-01-13
/
0 评论
/
740 阅读
/
正在检测是否收录...
01/13
JS-别踩白块游戏您的分数:0= 0 ){
cRow(); //追加元素
//行的数量大于5则把最后的元素删除
if( main.children.length > 5  ){
main.removeChild( main.lastChild );
}
if( main.lastChild.pass === undefined){ //如果没有点击黑块,且黑块碰底部了
gameOver();
}
main.style.top = (top-100) + 'px';  //追加新的行后,需要把定位再-掉自身增加的行高
}
}
//初始化
function init(){
for( var i=0; i=0 ){   //如果点击了黑块则 加分
score.innerHTML = scoreNum += 1;  //每次点击的分数
elment.classList.remove('black');
elment.parentNode.pass = true;   //在行内增加已点击过的标识
//没得5分速度+1
if( scoreNum % 5 == 0 ){
speed +=1;
}
}else{
gameOver();
}
}
mvDonw = setInterval('mainMove()',50); //定时滚动
}
//游戏结束
function gameOver(){
clearInterval(mvDonw);  //清楚定时器
gameStatus = false;  //游戏状态结束
alert('游戏结束,您总共获得的分数:'+ scoreNum + '分');
return false;
}
init();" _ue_custom_node_="true">

直接复制上面的代码保存 html 即可运行,或直接下载html源文件

index.rar


朗读
赞(0)
版权属于:

Dcr163的博客

本文链接:

http://dcr163.cn/201.html(转载时请注明本文出处及文章链接)

评论 (0)

人生倒计时

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. slot mpo terbaru
    2025-02-08
  2. Sherry Stockdill
    2025-01-28
  3. slot demo
    2025-01-13
  4. 陌天
    2025-01-09
  5. Kerrie Bostick
    2024-12-28

标签云