转载请标明出处:http://blog.csdn.net/waa_0618/article/details/54581457
源码下载地址
http://download.csdn.net/download/waa_0618/9741351
思路:
可能会出现的问题或者难点:
游戏的运行界面如下所示,基本的功能以及操作很简单。
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-3ShqlKPe-1595603247955)(https://img-blog.csdn.net/20170117150509362?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvd2FhXzA2MTg=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)]
下面分别介绍每个类的功能
/**
* 俄罗斯方块Game主界面
*
* @sign Created by wang.ao on 2017年1月12日
*/
@SuppressLint("DrawAllocation")
public class TetrisViewAW extends View {
/** 网格开始坐标值,横纵坐标的开始值都是此值 */
public static final int beginPoint = 10;
/** 俄罗斯方块的最大坐标 */
private static int max_x, max_y;
/** 行数和列数 */
private static int num_x = 0, num_y = 0;
/** 背景墙画笔 */
private static Paint paintWall = null;
/** 俄罗斯方块的单元块画笔 */
private static Paint paintBlock = null;
private static final int BOUND_WIDTH_OF_WALL = 2;
/** 当前正在下落的方块 */
private List blockUnits = new ArrayList();
/** 下一个要显示的方块 */
private List blockUnitBufs = new ArrayList();
/** 下一个要显示的方块 */
private List routeBlockUnitBufs = new ArrayList();
/** 全部的方块allBlockUnits */
private List allBlockUnits = new ArrayList();
/** 调用此对象的Activity对象 */
private TetrisActivityAW father = null;
private int[] map = new int[100]; // 保存每行网格中包含俄罗斯方块单元的个数
/** 游戏的主线程 */
private Thread mainThread = null;
// 游戏的几种状态
/** 标识游戏是开始还是停止 */
private boolean gameStatus = false;
/** 标识游戏是暂停还是运行 */
private boolean runningStatus = false;
/** 俄罗斯方块颜色数组 */
private static final int color[] = { Color.parseColor("#FF6600"), Color.BLUE, Color.RED, Color.GREEN, Color.GRAY };
/** 方块的中心方块单元的坐标, */
private int xx, yy;
/** 方块,用户随机获取各种形状的方块 */
private TetrisBlock tetrisBlock;
/** 分数 */
private int score = 0;
/** 当前方块的类型 */
private int blockType = 0;
public TetrisViewAW(Context context) {
this(context, null);
}
public TetrisViewAW(Context context, AttributeSet attrs) {
super(context, attrs);
if (paintWall == null) {// 初始化化背景墙画笔
paintWall = new Paint();
paintWall.setColor(Color.LTGRAY);
paintWall.setStyle(Paint.Style.STROKE);
paintWall.setStrokeWidth(BOUND_WIDTH_OF_WALL + 1);
}
if (paintBlock == null) {// 初始化化背景墙画笔
paintBlock = new Paint();
paintBlock.setColor(Color.parseColor("#FF6600"));
}
tetrisBlock = new TetrisBlock();
routeBlockUnitBufs = tetrisBlock.getUnits(beginPoint, beginPoint);
Arrays.fill(map, 0); // 每行网格中包含俄罗斯方块单元的个数全部初始化为0
// 绘制方块
}
/**
* 设置当前游戏页面的父类activity
*
* @param tetrisActivityAW
*/
public void setFather(TetrisActivityAW tetrisActivityAW) {
father = tetrisActivityAW;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
max_x = getWidth();
max_y = getHeight();
RectF rel;
// 绘制网格
num_x = 0;
num_y = 0;
for (int i = beginPoint; i < max_x - BlockUnit.UNIT_SIZE; i += BlockUnit.UNIT_SIZE) {
for (int j = beginPoint; j < max_y - BlockUnit.UNIT_SIZE; j += BlockUnit.UNIT_SIZE) {
rel = new RectF(i, j, i + BlockUnit.UNIT_SIZE, j + BlockUnit.UNIT_SIZE);
canvas.drawRoundRect(rel, 8, 8, paintWall);
num_y++;
}
num_x++;
}
// 随机产生一个俄罗斯方块
int len = blockUnits.size();
// 绘制方块
// Toast.makeText(context, "" + len, Toast.LENGTH_SHORT).show();
for (int i = 0; i < len; i++) {
int x = blockUnits.get(i).x;
int y = blockUnits.get(i).y;
// 设置当前方块的颜色
paintBlock.setColor(color[blockUnits.get(i).color]);
rel = new RectF(x + BOUND_WIDTH_OF_WALL, y + BOUND_WIDTH_OF_WALL,
x + BlockUnit.UNIT_SIZE - BOUND_WIDTH_OF_WALL, y + BlockUnit.UNIT_SIZE - BOUND_WIDTH_OF_WALL);
canvas.drawRoundRect(rel, 8, 8, paintBlock);
}
// 随机产生一个俄罗斯方块
len = allBlockUnits.size();
// 绘制方块
// Toast.makeText(context, "" + len, Toast.LENGTH_SHORT).show();
for (int i = 0; i < len; i++) {
int x = allBlockUnits.get(i).x;
int y = allBlockUnits.get(i).y;
paintBlock.setColor(color[allBlockUnits.get(i).color]);
rel = new RectF(x + BOUND_WIDTH_OF_WALL, y + BOUND_WIDTH_OF_WALL,
x + BlockUnit.UNIT_SIZE - BOUND_WIDTH_OF_WALL, y + BlockUnit.UNIT_SIZE - BOUND_WIDTH_OF_WALL);
canvas.drawRoundRect(rel, 8, 8, paintBlock);
}
}
/**
* 开始游戏
*/
public void startGame() {
gameStatus = true;
runningStatus = true;
if (mainThread == null || !mainThread.isAlive()) {
getNewBlock();
mainThread = new Thread(new MainThread());
mainThread.start();
}
}
/**
* 暂停游戏
*/
public void pauseGame() {
runningStatus = false;
}
/**
* 继续游戏
*/
public void continueGame() {
runningStatus = true;
}
/**
* 停止游戏
*/
public void stopGame() {
// 停止游戏,释放游戏主线程
runningStatus = false;
gameStatus = false;
mainThread.interrupt();
blockUnits.clear();
allBlockUnits.clear();
score = 0;
invalidate();
}
/**
* 向左滑动
*/
public void toLeft() {
if (BlockUnit.toLeft(blockUnits, max_x, allBlockUnits)) {
xx = xx - BlockUnit.UNIT_SIZE;
}
invalidate();
}
/**
* 向右滑动
*/
public void toRight() {
if (BlockUnit.toRight(blockUnits, max_x, allBlockUnits)) {
xx = xx + BlockUnit.UNIT_SIZE;
}
invalidate();
}
/**
* 按顺时针旋转
*/
public void route() {
if (blockType == 3) {// 如果当前正在下落的方块为正方形,则不进行旋转
return;
}
if (routeBlockUnitBufs.size() != blockUnits.size()) {
routeBlockUnitBufs = tetrisBlock.getUnits(xx, yy);
}
for (int i = 0; i < blockUnits.size(); i++) {
routeBlockUnitBufs.get(i).x = blockUnits.get(i).x;
routeBlockUnitBufs.get(i).y = blockUnits.get(i).y;
}
for (BlockUnit blockUnit : routeBlockUnitBufs) {
int tx = blockUnit.x;
int ty = blockUnit.y;
blockUnit.x = -(ty - yy) + xx;
blockUnit.y = tx - xx + yy;
}
routeTran(routeBlockUnitBufs);
if (!BlockUnit.canRoute(routeBlockUnitBufs, allBlockUnits)) {
// Toast.makeText(father, "不可旋转", Toast.LENGTH_SHORT).show();
return;
}
for (BlockUnit blockUnit : blockUnits) {
int tx = blockUnit.x;
int ty = blockUnit.y;
blockUnit.x = -(ty - yy) + xx;
blockUnit.y = tx - xx + yy;
}
routeTran(blockUnits);
invalidate();
}
/**
* 如果方块处于边缘,则翻转过后,会出现方块部分处于边缘之外的情况, 因此,通过递归判断是否有超出边缘的部分,
* 如果有,则进行左右平移,把处于边缘外的方块移动到边缘内
*/
public void routeTran(List blockUnitsBuf) {
boolean needLeftTran = false;
boolean needRightTran = false;
for (BlockUnit u : blockUnitsBuf) {
if (u.x < beginPoint) {
needLeftTran = true;
}
if (u.x > max_x - BlockUnit.UNIT_SIZE) {
needRightTran = true;
}
}
if (needLeftTran || needRightTran) {
for (BlockUnit u : blockUnitsBuf) {
if (needLeftTran) {
u.x = u.x + BlockUnit.UNIT_SIZE;
} else if (needRightTran) {
u.x = u.x - BlockUnit.UNIT_SIZE;
}
}
routeTran(blockUnitsBuf);
} else {
return;
}
}
/**
* 获取一个新的方块
*/
private void getNewBlock() {
// 新的方块的坐标,x坐标位于x轴的中间,y 位于起始位置
this.xx = beginPoint + (num_x / 2) * BlockUnit.UNIT_SIZE;
this.yy = beginPoint;
if (blockUnitBufs.size() == 0) {
// 当游戏第一次开始的时候,先初始化一个方块
blockUnitBufs = tetrisBlock.getUnits(xx, yy);
}
blockUnits = blockUnitBufs;
blockType = tetrisBlock.blockType;
blockUnitBufs = tetrisBlock.getUnits(xx, yy);
if (father != null) {// 显示出下一个要出现的方块
father.setNextBlockView(blockUnitBufs, (num_x / 2) * BlockUnit.UNIT_SIZE);
}
}
/**
* 游戏的主线程
*
* @sign Created by wang.ao on 2017年1月16日
*/
private class MainThread implements Runnable {
@Override
public void run() {
while (gameStatus) {
while (runningStatus) {
if (BlockUnit.canMoveToDown(blockUnits, max_y, allBlockUnits)) {
// 判断是否可以继续下落,如果可以下落,则下落
BlockUnit.toDown(blockUnits, max_y, allBlockUnits);
yy = yy + BlockUnit.UNIT_SIZE;
} else {
/**
* 当不可以继续下落的时候,把当前的方块添加到allBlockUnits中,
* 并且判断是否有需要消除的方块,然后再产生一个新的方块
*/
for (BlockUnit blockUnit : blockUnits) {
blockUnit.y = blockUnit.y + BlockUnit.UNIT_SIZE;
allBlockUnits.add(blockUnit);
}
for (BlockUnit u : blockUnits) {
// 更新map,即更新每行网格中静止俄罗斯方块单元的个数
int index = (int) ((u.y - beginPoint) / 50); // 计算所在行数
map[index]++;
}
// 每行最大个数
int end = (int) ((max_y - 50 - beginPoint) / BlockUnit.UNIT_SIZE);
int full = (int) ((max_x - 50 - beginPoint) / BlockUnit.UNIT_SIZE) + 1;
try {
Thread.sleep(GameConfig.SPEED);
} catch (InterruptedException e) {
e.printStackTrace();
}
for (int i = 0; i <= end; i++) {
/***
* 消除需要消除的方块(触发条件,某一行中被塞满了方块,没有空白)
* 注意顺序,先消除某一行,再移动这一行上边的方块
*/
if (map[i] >= full) {
BlockUnit.remove(allBlockUnits, i);
score += 100;
map[i] = 0;
for (int j = i; j > 0; j--)
map[j] = map[j - 1];
map[0] = 0;
for (BlockUnit blockUnit : allBlockUnits) {
if (blockUnit.y < (i * BlockUnit.UNIT_SIZE + beginPoint)) {
blockUnit.y = blockUnit.y + BlockUnit.UNIT_SIZE;
}
}
}
}
father.runOnUiThread(new Runnable() {
@Override
public void run() {
/**
* 刷新分数
*/
father.score.setText("" + score);
invalidate();
}
});
try {
Thread.sleep(GameConfig.SPEED * 3);
} catch (InterruptedException e) {
e.printStackTrace();
}
father.runOnUiThread(new Runnable() {
@Override
public void run() {
getNewBlock();
score += 10;
father.score.setText("" + score);
}
});
}
father.runOnUiThread(new Runnable() {
@Override
public void run() {
invalidate();
}
});
try {
Thread.sleep(GameConfig.SPEED);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
}
}
/**
* 俄罗斯方块的单元快
*
* @sign Created by wang.ao on 2017年1月13日
*/
public class BlockUnit {
public static final int UNIT_SIZE = 50;
public static final int BEGIN = 10;
public int color;
// 单元块 的坐标
public int x, y;
public BlockUnit() {
}
public BlockUnit(int x, int y, int color) {
/*
* @param 单元块横纵坐标 构造函数
*/
this.x = x;
this.y = y;
this.color = color;
}
/**
* 判断方块是否可以向左移动,1是否在边缘,2是否会与其他方块重合
* @param blockUnits 当前正在下落的方块
* @param max_x 游戏主界面X轴的最大值 ,下同
* @param allBlockUnits 所有的方块
* @return 能移动true;不能移动false
*/
public static boolean canMoveToLeft(List blockUnits, int max_x, List allBlockUnits) {
for (BlockUnit blockUnit : blockUnits) {
int x = blockUnit.x;
if (x - UNIT_SIZE < BEGIN) {
return false;
}
int y = blockUnit.y;
if (isSameUnit(x - UNIT_SIZE, y, allBlockUnits)) {
return false;
}
}
return true;
}
/**
* 判断方块是否可以向右移动,1是否在边缘,2是否会与其他方块重合
* @param blockUnits 当前正在下落的方块
* @param max_x 游戏主界面X轴的最大值 ,下同
* @param allBlockUnits 所有的方块
* @return 能移动true;不能移动false
*/
public static boolean canMoveToRight(List blockUnits, int max_x, List allBlockUnits) {
for (BlockUnit blockUnit : blockUnits) {
int x = blockUnit.x;
if (x + UNIT_SIZE > max_x - UNIT_SIZE) {
return false;
}
int y = blockUnit.y;
if (isSameUnit(x + UNIT_SIZE, y, allBlockUnits)) {
return false;
}
}
return true;
}
/**
* 判断方块是否可以向下移动,1是否在边缘,2是否会与其他方块重合
* @param blockUnits 当前正在下落的方块
* @param max_x 游戏主界面X轴的最大值 ,下同
* @param allBlockUnits 所有的方块
* @return 能移动true;不能移动false
*/
public static boolean canMoveToDown(List blockUnits, int max_y, List allBlockUnits) {
for (BlockUnit blockUnit : blockUnits) {
int x = blockUnit.x;
int y = blockUnit.y + UNIT_SIZE * 2;
if (y > max_y - UNIT_SIZE) {
return false;
}
if (isSameUnit(x, y, allBlockUnits)) {
return false;
}
}
return true;
}
public static boolean canRoute(List blockUnits, List allBlockUnits){
for (BlockUnit blockUnit: blockUnits) {
if(isSameUnit(blockUnit.x, blockUnit.y, allBlockUnits)){
return false;
}
}
return true;
}
/**
* 把当前方块向左移动一格
* @param blockUnits
* @param max_x
* @param allBlockUnits
* @return 是否成功移动一格,是:true,否:false
*/
public static boolean toLeft(List blockUnits, int max_x, List allBlockUnits) {
if (canMoveToLeft(blockUnits, max_x, allBlockUnits)) {
for (BlockUnit blockUnit : blockUnits) {
blockUnit.x = blockUnit.x - UNIT_SIZE;
}
return true;
}
return false;
}
/**
* 把当前方块向右移动一格
* @param blockUnits
* @param max_x
* @param allBlockUnits
* @return 是否成功移动一格,是:true,否:false
*/
public static boolean toRight(List blockUnits, int max_x, List allBlockUnits) {
if (canMoveToRight(blockUnits, max_x, allBlockUnits)) {
for (BlockUnit blockUnit : blockUnits) {
blockUnit.x = blockUnit.x + UNIT_SIZE;
}
return true;
}
return false;
}
/**
* 把当前方块下落一格
* @param blockUnits
* @param allBlockUnits
* @return 是否成功移动一格,是:true,否:false
*/
public static void toDown(List blockUnits, int max_Y, List allBlockUnits) {
for (BlockUnit blockUnit : blockUnits) {
blockUnit.y = blockUnit.y + BlockUnit.UNIT_SIZE;
}
}
/**
* 判断 方块单元是否和所有方块有重合
* @param x
* @param y
* @param allBlockUnits
* @return
*/
public static boolean isSameUnit(int x, int y, List allBlockUnits) {
for (BlockUnit blockUnit : allBlockUnits) {
if (Math.abs(x - blockUnit.x) < UNIT_SIZE && Math.abs(y - blockUnit.y) < UNIT_SIZE) {
return true;
}
}
return false;
}
/**
* 删除在第j行上的方块单元
* @param allBlockUnits
* @param j 需删除行标
*/
public static void remove(List allBlockUnits, int j) {
for (int i = allBlockUnits.size() - 1; i >= 0; i--) {
/*
* ①逆向遍历 ②根据y坐标计算单元所在行,若为j行则从units中删除
*/
if ((int) ((allBlockUnits.get(i).y - BEGIN) / 50) == j)
allBlockUnits.remove(i);
}
}
}
/**
* 方块
*
* @sign Created by wang.ao on 2017年1月13日
*/
public class TetrisBlock {
private static final int TYPE_SUM = 7;
public int blockType, blockDirection; // 方块种类,方块朝向
private int color; // 方块颜色
private int x, y; // 方块坐标
public TetrisBlock() {
}
public TetrisBlock(int x, int y) {
this.x = x;
this.y = y;
}
public List getUnits(int x, int y) {
this.x = x;
this.y = y;
return returnUnit();
}
/**
* 随机产生一种方块
* @return
*/
public List returnUnit() {
List units = new ArrayList(); // 方块组成部分
blockType = (int) (Math.random() * TYPE_SUM) + 1; // 随机生成一个种类
blockDirection = 1; // 默认初始方向
color = (int) (Math.random() * 4) + 1; // 随机生成一个颜色
units.clear();
switch (blockType) {
case 1:// 横线
for (int i = 0; i < 4; i++) {
units.add(new BlockUnit(x + (-2 + i) * BlockUnit.UNIT_SIZE, y, color));
}
break;
case 2:
units.add(new BlockUnit(x + (-1 + 1) * BlockUnit.UNIT_SIZE, y - BlockUnit.UNIT_SIZE, color));
for (int i = 0; i < 3; i++) {
units.add(new BlockUnit(x + (-1 + i) * BlockUnit.UNIT_SIZE, y, color));
}
break;
case 3:
for (int i = 0; i < 2; i++) {
units.add(new BlockUnit(x + (i - 1) * BlockUnit.UNIT_SIZE, y - BlockUnit.UNIT_SIZE, color));
units.add(new BlockUnit(x + (i - 1) * BlockUnit.UNIT_SIZE, y, color));
}
break;
case 4:
units.add(new BlockUnit(x + (-1 + 0) * BlockUnit.UNIT_SIZE, y - BlockUnit.UNIT_SIZE, color));
for (int i = 0; i < 3; i++) {
units.add(new BlockUnit(x + (-1 + i) * BlockUnit.UNIT_SIZE, y, color));
}
break;
case 5:
units.add(new BlockUnit(x + (-1 + 2) * BlockUnit.UNIT_SIZE, y - BlockUnit.UNIT_SIZE, color));
for (int i = 0; i < 3; i++) {
units.add(new BlockUnit(x + (-1 + i) * BlockUnit.UNIT_SIZE, y, color));
}
break;
case 6:
for (int i = 0; i < 2; i++) {
units.add(new BlockUnit(x + (-1 + i) * BlockUnit.UNIT_SIZE, y - BlockUnit.UNIT_SIZE, color));
units.add(new BlockUnit(x + i * BlockUnit.UNIT_SIZE, y, color));
}
break;
case 7:
for (int i = 0; i < 2; i++) {
units.add(new BlockUnit(x + i * BlockUnit.UNIT_SIZE, y - BlockUnit.UNIT_SIZE, color));
units.add(new BlockUnit(x + (-1 + i) * BlockUnit.UNIT_SIZE, y, color));
}
break;
}
return units;
}
/**
* 下一个要展示的方块
*
* @sign Created by wang.ao on 2017年1月13日
*/
@SuppressLint("DrawAllocation")
public class NextBlockView extends View {
/** 网格开始坐标值,横纵坐标的开始值都是此值 */
public static final int beginPoint = 10;
/** 俄罗斯方块的最大坐标 */
private static int max_x, max_y;
private List blockUnits = new ArrayList();
/** 背景墙画笔 */
private static Paint paintWall = null;
private static final int BOUND_WIDTH_OF_WALL = 2;
private static Paint paintBlock = null;
private int div_x = 0;
// 俄罗斯方块颜色数组
private static final int color[] ={ Color.parseColor("#FF6600"), Color.BLUE, Color.RED, Color.GREEN, Color.GRAY };
public NextBlockView(Context context) {
this(context, null);
}
public NextBlockView(Context context, AttributeSet attrs) {
super(context, attrs);
if (paintWall == null) {// 初始化化背景墙画笔
paintWall = new Paint();
paintWall.setColor(Color.LTGRAY);
paintWall.setStyle(Paint.Style.STROKE);
paintWall.setStrokeWidth(BOUND_WIDTH_OF_WALL + 1);
}
if (paintBlock == null) {// 初始化化背景墙画笔
paintBlock = new Paint();
paintBlock.setColor(Color.parseColor("#FF6600"));
}
}
public void setBlockUnits(List blockUnits, int div_x) {
this.blockUnits = blockUnits;
this.div_x = div_x;
invalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
max_x = getWidth();
max_y = getHeight();
RectF rel;
// 绘制网格
int len = blockUnits.size();
// 绘制方块
// Toast.makeText(context, "" + len, Toast.LENGTH_SHORT).show();
for (int i = 0; i < len; i++) {
paintBlock.setColor(color[blockUnits.get(i).color]);
int x = blockUnits.get(i).x - div_x + BlockUnit.UNIT_SIZE * 2;
int y = blockUnits.get(i).y + BlockUnit.UNIT_SIZE * 2;
rel = new RectF(x + BOUND_WIDTH_OF_WALL, y + BOUND_WIDTH_OF_WALL,
x + BlockUnit.UNIT_SIZE - BOUND_WIDTH_OF_WALL, y + BlockUnit.UNIT_SIZE - BOUND_WIDTH_OF_WALL);
canvas.drawRoundRect(rel, 8, 8, paintBlock);
rel = new RectF(x, y, x + BlockUnit.UNIT_SIZE, y + BlockUnit.UNIT_SIZE);
canvas.drawRoundRect(rel, 8, 8, paintWall);
}
}
}
public class GameConfig {
/**方块下落的速度*/
public static final int SPEED = 300;
}
public class TetrisActivityAW extends Activity {
private NextBlockView nextBlockView;
private TetrisViewAW tetrisViewAW;
private TextView gameStatusTip;
public TextView score;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tetris_activity_aw);
nextBlockView = (NextBlockView) findViewById(R.id.nextBlockView1);
tetrisViewAW = (TetrisViewAW) findViewById(R.id.tetrisViewAW1);
tetrisViewAW.setFather(this);
gameStatusTip = (TextView) findViewById(R.id.game_staus_tip);
score = (TextView) findViewById(R.id.score);
}
public void setNextBlockView(List blockUnits, int div_x) {
nextBlockView.setBlockUnits(blockUnits, div_x);
}
/**
* 开始游戏
*
* @param view
*/
public void startGame(View view) {
tetrisViewAW.startGame();
gameStatusTip.setText("游戏运行中");
}
/**
* 暂停游戏
*/
public void pauseGame(View view) {
tetrisViewAW.pauseGame();
gameStatusTip.setText("游戏已暂停");
}
/**
* 继续游戏
*/
public void continueGame(View view) {
tetrisViewAW.continueGame();
gameStatusTip.setText("游戏运行中");
}
/**
* 停止游戏
*/
public void stopGame(View view) {
tetrisViewAW.stopGame();
score.setText(""+0);
gameStatusTip.setText("游戏已停止");
}
/**
* 向左滑动
*/
public void toLeft(View view) {
tetrisViewAW.toLeft();
}
/**
* 向右滑动
*/
public void toRight(View view) {
tetrisViewAW.toRight();
}
/**
* 向右滑动
*/
public void toRoute(View view) {
tetrisViewAW.route();
}
}
整个项目就是这些,代码已经全部贴出来了。
整个项目写的时候,以为很简单,但是却遇到了很多问题,不过都已解决。欢迎来找bug,大家共同进步。
http://download.csdn.net/download/waa_0618/9741351