一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

一个javascript脚本写的俄罗斯方块 (2)Russia.js

时间:2022-06-30 09:52:25 编辑:袖梨 来源:一聚教程网

var Cols = 10, Rows = 20, Sqlen = 16;
var Color = new Array(8);
var delLine = new Array();
var CLoc = new Array();
var RLoc = new Array();
var CurSq,NextSq;
var type=-1,oldtype;
var delay = new Array(600,500,400,300,200,100,90,80,70);
var TimerID;
var pos = 0,end,level=0,score=0,lines=0;
var isOver=false,isPause=false;
Color[0] = "#d0d0d0";
Color[1] = "red";
Color[2] = "green"
Color[3] = "cyan";
Color[4] = "yellow";
Color[5] = "orange";
Color[6] = "pink";
Color[7] = "blue";
function GameArea(row,col,name){
var s = "";
for(var i=0; i    s = s + "";
    for(var j=0; j     var id = name + i + "#" + j;
     s = s + "
"
    }
    s = s + "";
}
s = s + "
 
";
return s;
}
function Init(){
GameBody.innerHTML = GameArea(Rows,Cols,'Main');
GameForecast.innerHTML = GameArea(4,4,'Forecast');
}
function Square(cols,rows,color){
this.rows = rows;
this.cols = cols;
this.color = color;
}
function chooseSquare(type,x,y){
var sq = new Array(4);
switch(type){
    case 0:
     sq[0] = new Square(x-1,y,1);
     sq[1] = new Square(x,y,1);
     sq[2] = new Square(x+1,y,1);

热门栏目