
正文
javascript+html5+canvse+3d俄罗斯方块
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
javascript+html5+canvse+3d俄罗斯方块
必须使用支持html5的浏览器打开,比如firefox,chrome
得分:0速度:1000
// 你的浏览器不支持 <canvas>标签,请使用 Chrome 浏览器 或者 FireFox 浏览器'); document.write('你的浏览器不支持 <canvas>标签,请使用 Chrome 浏览器 或者 FireFox 浏览器'); // ]]> |
|
// 0)return 1;//IE
if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0)return 2;//Firefox
if (isSafari = navigator.userAgent.indexOf("Chrome") > 0)return 3;//Chrome
if (isSafari = navigator.userAgent.indexOf("Safari") > 0)return 4;//Safari
if (isCamino = navigator.userAgent.indexOf("Camino") > 0)return 5;//Camino
if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0)return 6;//Gecko
//other...
return 0;
}
var tableHTML = function(trLen, tdLen) {
var str = "";
for (var i = 0; i ";
for (var j = 0; j
";
}
str += "
";
}
return str;
};
var isInclude = function(array, element, start) {
var alen = array.length;
for (var i = start; i =this.mainCanvas.XLen || xyz[1]>=this.mainCanvas.YLen || xyz[2]>=this.mainCanvas.ZLen)return false;
return !isInclude(this.staticBlock, xyz, 0);
};
Game.prototype.gridsAreBlank = function(array) {
for(var i=0;i= this.levelArr[i][0]) {
this.setLevel(this.levelArr[i][1]);
break;
}
}
};
Game.prototype.setScoreLabel = function(sl) {
this.scoreLabel = sl;
};
Game.prototype.setScore = function(score) {
this.score = score;
if(this.scoreLabel)this.scoreLabel.innerHTML = this.score;
};
Game.prototype.computeScore = function(n) {
for (var i = 1; i = winScore) {
// win();
// }
// }, this.flashSpeed * 6);
// }
if(toRemoves.length > 0){
this.computeScore(toRemoves.length);
this.computeLevel();
var newSB = [];
for(i=0;i= this.winScore) {
this.win();
}
else{
this.create();
}
};
Game.prototype.drop = function() {
if(this.paused)return;
if (!(this.activeBlock.length == 0)) {
if (this.hasSpaces(this.activeBlock, [0,1,0])) {
// l('activeBlock hasSpaces');
this.directOneGrid([0,1,0]);
}
else {
// l('activeBlock do not hasSpaces');
clearInterval(this.inter);
this.abToSB();
this.removeFull();
}
}
};
Game.prototype.dropToBottom = function(xyz) {
if(this.paused)return;
clearInterval(this.inter);
var _this = this;
this.inter = setInterval(function(){_this.drop();}, 20);
};
Game.prototype.autoDrop = function() {
if(this.paused)return;
clearInterval(this.inter);
var _this = this;
this.inter = setInterval(function(){_this.drop();}, _this.level);
};
//axle: "x", "y", "z", "o"
Game.prototype.transformAB = function(axle) {
var newBlock = [];
newBlock[0] = this.activeBlock[0];
for (var i = 1; i 0) {
var newBlock = this.transformAB(axle);
if(this.blockAreBlank(newBlock)){
this.clearAB();
this.setAB(newBlock);
this.fillAB();
}
}
};
Game.prototype.init = function() {
this.setScoreLabel(document.getElementById("score"));
this.setLevelLabel(document.getElementById("level"));
var table_names = ['front', 'top', 'left'];
for(var i=0;i
//








