table.java

来自「Java 开发的俄罗斯方块游戏」· Java 代码 · 共 41 行

JAVA
41
字号

public class Table {
	private static int x = 20;//游戏数组的高;
	private static int y = 15;//游戏数组的宽
	public static int[][] mytable = new int[x][y];//游戏桌对应的游戏数组,这个数组很重要的
	public Table(){
		this.x = 20;
		this.y = 15;
	}
	
	public static int getX() {
		return x;
	}
	public static void setX(int x) {
		Table.x = x;
	}
	public static int getY() {
		return y;
	}
	public static void setY(int y) {
		Table.y = y;
	}
	//打印出游戏数组的值的情况,本方法是用来进行测试用的,测试已经通过了,可以删去了
	public static void showTable(){
		for(int i = 0 ; i < x ; i ++){
			for(int j = 0; j <y ; j ++){
				System.out.print(mytable[i][j]);
			}
			System.out.println("第"+i+"行");
		}
	}
	//游戏数组初时化
	public static void init (){
		for(int i = 0; i < x ; i ++){
			for(int j = 0 ; j < y ; j ++){
				mytable[i][j] = 0 ;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?