所属分类:游戏

js拼图游戏

43316 浏览 442 收藏 24 留言
ie兼容10

插件描述

利用js实现拼图游戏

更新时间
2015-12-20 23:12
下载量
635
所需 JQ 币
3
分类
其他 / 游戏

详细内容

做个小游戏,练习js。

Game.prototype.findNear = function(o) {
    var iMin = 99999,
    index = -1;
    for (var i = 0; i < this.len; i++) {
        this.item[i].className = '';
        if (this.checkPZ(o, this.item[i])) {
            var l = dis(o, this.item[i]);
            if (iMin > l) {
                iMin = l;
                index = i;
            };
        }
    };
    if (index == -1) {
        return null;
    } else {
        return this.item[index];
    };
    function dis(o1, o2) {
        var c1 = o1.offsetLeft - o2.offsetLeft,
        c2 = o1.offsetTop - o2.offsetTop;
        return Math.sqrt(c1 * c1 + c2 * c2);
    }
};

var t = new Game(5, 5); //行与列,值越大,难度越高
document.getElementById('start').onclick = function() {
    t.startGame();
}


关键词:js拼图游戏,拼图,游戏,jquery,jquery插件

讨论这个项目 (24)

共 24 条留言,当前展示最近 15 条顶层留言及回复。

redguitar
移动端。。。。。。。。。。。。。。。。。。。。。
我就是烦恼 touch 了
wangmingdong
6666
Designed

6666666666666

王之平

很不错啊 厉害厉害

自渡
做一个
芒果001

666

吾愿丶化身石桥°

66666666666666

夏默。

真的不错

Desperate struggle

图片怎么能随意拖动

小强

能不能自己添加图片。。。

luluniu
很好,要收藏了
yuing
很棒,果断收藏
caijinming
很棒收藏了。
施焕玲O-O

收藏~~

zzfff
好厉害的说
Tinsson

效果很棒

战场原
酷,非常酷。非常厉害。谢谢。
luluniu
厉害
更多留言 →

当前页面为只读展示,仅显示已审核留言;提交留言功能暂未开放。