⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rectangle.java

📁 这是我自己写的一个小的JAVA实现的俄罗斯方块
💻 JAVA
字号:
package net.rectang;import java.util.Random;public class Rectangle {	/**	 * 每个小方块大小	 */	private int retangSize = 10;	/**	 * 中心小方块位置	 */	private Index center = new Index(65, RectangActionController.DEFAULT_SIZE);;	private Index index1 = null;	private Index index2 = null;	private Index index3 = null;	private Index index4 = null;	private Index index5 = null;	private Index index6 = null;	private Index index7 = null;	private Index index8 = null;	private Index index9 = null;		private IndexLocation[] allType = new IndexLocation[14];	public Rectangle() {		super();		this.center = new Index(65, RectangActionController.DEFAULT_SIZE);				this.index1 = new Index(center.getLocationX() - retangSize, center.getLocationY() - retangSize);		this.index2 = new Index(center.getLocationX(), center.getLocationY() - retangSize);		this.index3 = new Index(center.getLocationX() + retangSize, center.getLocationY() - retangSize);		this.index4 = new Index(center.getLocationX() - retangSize, center.getLocationY());		this.index5 = new Index(center.getLocationX() + retangSize, center.getLocationY());		this.index6 = new Index(center.getLocationX() - retangSize, center.getLocationY() + retangSize);		this.index7 = new Index(center.getLocationX(), center.getLocationY() + retangSize);		this.index8 = new Index(center.getLocationX() + retangSize, center.getLocationY() + retangSize);		this.index9 = new Index(center.getLocationX(), center.getLocationY() - 2 * retangSize);				allType[0] = new IndexLocation(center, index2, index7, index9);		allType[1] = new IndexLocation(center, index2, index3, index5);		allType[2] = new IndexLocation(center, index2, index7, index5);		allType[3] = new IndexLocation(center, index2, index7, index4);		allType[4] = new IndexLocation(center, index2, index5, index8);		allType[5] = new IndexLocation(center, index2, index3, index4);		allType[6] = new IndexLocation(center, index3, index5, index7);		allType[7] = new IndexLocation(center, index1, index2, index5);		allType[8] = new IndexLocation(center, index2, index3, index7);		allType[9] = new IndexLocation(center, index1, index4, index5);		allType[10] = new IndexLocation(center, index2, index7, index6);		allType[11] = new IndexLocation(center, index2, index7, index1);		allType[12] = new IndexLocation(center, index4, index6, index5);		allType[13] = new IndexLocation(center, index2, index7, index8);	}		public IndexLocation getAllLocation(){		Random random = new Random();		int i = random.nextInt(14);		//System.out.println(i);		return allType[i];	}	public int getRetangSize() {		return retangSize;	}	public void setRetangSize(int retangSize) {		this.retangSize = retangSize;	}	public Index getCenter() {		return center;	}	public void setCenter(Index center) {		this.center = center;	}	}

⌨️ 快捷键说明

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