Курсовая работа: Java-гра Тетріс
Color.PINK,
Color.YELLOW
};
private int type;
private int[][] pat;
private int x,y,rotation;
private static Random r = new Random();
private static int nextType = 0;
private static int nextRot = -1;
public Figure() {
if (nextType==0) {
type = r.nextInt(PATTERN.length-1)+1;
rotation = r.nextInt(4);
} else {
type = nextType;
rotation = nextRot;
}
nextType = r.nextInt(PATTERN.length-1)+1;
y = 0; x = 4;
nextRot = r.nextInt(4);
pat = new int[PATTERN[type].length]
[PATTERN[type][0].length];
for (int i=0; i<pat.length; i++)
for (int j=0; j<pat[i].length; j++) {
pat[i][j] = PATTERN[type][i][j];
}
for (int i=0; i<rotation; i++) rotate();
}
public int getX() {