shapefactory.java

来自「培训老师写的nb代码,midp1.0画出来的游戏」· Java 代码 · 共 46 行

JAVA
46
字号
import java.util.Random;

public class ShapeFactory 
{
	private int[][][] shapes = 
	{
			{
				{
				 1,0,0,0,
				 1,1,1,0 ,
				 0,0,0,0 ,
				 0,0,0,0
				},
				{
					1,1,0,0,
					1,0,0,0,
					1,0,0,0,
					0,0,0,0
				},
				{
					1,1,1,0,
					0,0,1,0,
					0,0,0,0,
					0,0,0,0
				},
				{
					0,1,0,0,
					0,1,0,0,
					1,1,0,0,
					0,0,0,0
				}
			}
	};
	
	public Shape getShape(ShapeListener lis)
	{
		System.out.println("getShape()");
		Shape shape = new Shape();
		int type = new Random().nextInt(shapes.length);
		shape.setBody(shapes[type]);
		shape.setStatus(new Random().nextInt(4));
		shape.addListener(lis);
		return shape;
	}
}

⌨️ 快捷键说明

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