package entities; import java.awt.Color; import java.util.Random; import util.Global; public class BlockFactory { protected int blockpattern1[][][] = { { {1,1,0,0}, {1,1,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,1,0,0}, {1,1,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,1,0,0}, {1,1,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,1,0,0}, {1,1,0,0}, {0,0,0,0}, {0,0,0,0}}}; protected int blockpattern2[][][] = { { {0,1,0,0}, {0,1,0,0}, {1,1,0,0}, {0,0,0,0}}, { {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}}}; protected int blockpattern3[][][] = { { {1,0,0,0}, {1,0,0,0}, {1,1,0,0}, {0,0,0,0}}, { {1,1,1,0}, {1,0,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,1,0,0}, {0,1,0,0}, {0,1,0,0}, {0,0,0,0}}, { {0,0,1,0}, {1,1,1,0}, {0,0,0,0}, {0,0,0,0}}}; protected int blockpattern4[][][] = { { {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}}, { {1,1,1,1}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,1,1,1}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}}}; protected int blockpattern5[][][] = { { {1,1,0,0}, {0,1,1,0}, {0,0,0,0}, {0,0,0,0}}, { {0,1,0,0}, {1,1,0,0}, {1,0,0,0}, {0,0,0,0}}, { {1,1,0,0}, {0,1,1,0}, {0,0,0,0}, {0,0,0,0}}, { {0,1,0,0}, {1,1,0,0}, {1,0,0,0}, {0,0,0,0}}}; protected int blockpattern6[][][] = { { {0,1,1,0}, {1,1,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,0,0,0}, {1,1,0,0}, {0,1,0,0}, {0,0,0,0}}, { {0,1,1,0}, {1,1,0,0}, {0,0,0,0}, {0,0,0,0}}, { {1,0,0,0}, {1,1,0,0}, {0,1,0,0}, {0,0,0,0}}}; protected int blockpattern7[][][] = { { {1,1,1,0}, {0,1,0,0}, {0,0,0,0}, {0,0,0,0}}, { {0,1,0,0}, {1,1,0,0}, {0,1,0,0}, {0,0,0,0}}, { {0,1,0,0}, {1,1,1,0}, {0,0,0,0}, {0,0,0,0}}, { {1,0,0,0}, {1,1,0,0}, {1,0,0,0}, {0,0,0,0}}}; protected Random random = new Random(); /** 产生一个方块 */ public Block getBlock() { int[][][] blockpattern = null; int randomPattern = random.nextInt(7) + 1; int randomRotate = random.nextInt(4); switch (randomPattern) { case 1: blockpattern = blockpattern1; break; case 2: blockpattern = blockpattern2; break; case 3: blockpattern = blockpattern3; break; case 4: blockpattern = blockpattern4; break; case 5: blockpattern = blockpattern5; break; case 6: blockpattern = blockpattern6; break; case 7: blockpattern = blockpattern7; break; } Color color = Global.getRandomColor(); Block block = new Block(blockpattern, randomRotate, color); return block; } }
最近下载更多
yx666666 LV1
1月5日
ClydeSon LV5
2023年12月27日
1351408674 LV1
2023年12月27日
1112WHQ LV7
2023年11月3日
ggl163163eel LV2
2023年10月18日
wangjialiang1 LV17
2023年8月20日
大白8加3 LV1
2023年8月18日
XVXIAOPING LV1
2022年12月21日
微信网友_6268131861106688 LV5
2022年12月21日
balabalawuyu LV6
2022年11月26日
最近浏览更多
3296029180
1月18日
暂无贡献等级
yx666666 LV1
1月5日
ClydeSon LV5
2023年12月27日
1351408674 LV1
2023年12月27日
Kunyuu LV1
2023年12月26日
lshlsh
2023年12月25日
暂无贡献等级
1112WHQ LV7
2023年11月3日
微信网友_6699076084797440 LV7
2023年10月30日
jiemomo LV12
2023年10月19日
ggl163163eel LV2
2023年10月18日