Fail 发表于 2020-10-24 09:49:12

HTML小游戏,找色差游戏,没事儿可以解闷(附源代码)







如图所示,就是找不同,简单的一个休闲小游戏

链接:https://pan.baidu.com/s/1ompL2trC1e6tfx4tpaePaw 提取码:ph9v

function find() {
    var box = document.getElementById("box");
    var blocks = box.childNodes;
    var i, c, n, t;
    for (i = 0; i < blocks.length - 1; i++) {
      c = blocks.style["backgroundColor"];
      n = blocks.style["backgroundColor"];
      if (c != n)
            break;
    };

    if (i == 0)
      t = blocks.style["backgroundColor"];
    else
      t = blocks.style["backgroundColor"];

    if (c == t)
      return i + 1;
    else
      return i;
};

setInterval(function () {
    var crazyModel = true;
    if (crazyModel) {
      //疯狂屠戮模式
      document.getElementById("box").childNodes.click();
    } else {
      //辅助瞄准模式
      document.getElementById("box").childNodes.style.border = "5px solid black";
    }
}, 100);//这个值越小,屠戮模式越疯狂……

页: [1]
查看完整版本: HTML小游戏,找色差游戏,没事儿可以解闷(附源代码)