用JavaScript 写的俄罗斯方块, 实现了几个比较简单的功能: 自定义按键, 设置初始速度,难度和方块,换肤功能。
布局用的Div+Css
演示地址:http://58.61.155.48:818/Tetris.html 下载:http://download.csdn.net/source/430506 http://58.61.155.48:818/Tetris.rar
程序主要用了三个类, 窗口类、菜单类、游戏类和一个基类。
1.基类, 定义了一些常用属性和函数.
//声明命名空间var Freewind = ...{};//基类Freewind.Base = function()...{ //浏览器 this._isIE = document.all ? true : false; //对象索引 this._nIndex = 0; //大小 this._nLeft = 0; this._nTop = 0; this._nWidth = DEF_WIN_WIDTH; this._nHeight