所属分类:游戏
js拼图游戏
43316 浏览
442 收藏
24 留言
插件描述
利用js实现拼图游戏
详细内容
做个小游戏,练习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 条顶层留言及回复。
更多留言 →当前页面为只读展示,仅显示已审核留言;提交留言功能暂未开放。
我就是烦恼 touch 了
6666666666666
很不错啊 厉害厉害
666
66666666666666
真的不错
图片怎么能随意拖动
能不能自己添加图片。。。
收藏~~