diff --git a/Meteo_Engine.jar b/Meteo_Engine.jar index 8d657ed..a0676b9 100644 Binary files a/Meteo_Engine.jar and b/Meteo_Engine.jar differ diff --git a/src/sig/Block.java b/src/sig/Block.java index 4a0b470..8e5ea08 100644 --- a/src/sig/Block.java +++ b/src/sig/Block.java @@ -16,7 +16,7 @@ public class Block{ public Block(int x,int y) { this.x=x; this.y=y; - state = STARTINGSTATES[(int)(Meteo.r.nextInt(1))]; + state = STARTINGSTATES[(int)(Meteo.r.nextInt(3))]; } @Override public String toString() { diff --git a/src/sig/Board.java b/src/sig/Board.java index 2d68892..326a805 100644 --- a/src/sig/Board.java +++ b/src/sig/Board.java @@ -19,6 +19,13 @@ public class Board { int x,y; int block_width,block_height; double vspeed; + final static BlockState[] STARTINGSTATES = {BlockState.BLUE, + BlockState.GREEN, + BlockState.ORANGE, + BlockState.PURPLE, + BlockState.RED, + BlockState.WHITE, + BlockState.YELLOW,}; List blockClumpDeleteList = new ArrayList(); List blockClumpAddList = new ArrayList(); @@ -127,7 +134,7 @@ public class Board { //System.out.println(blocks.getSortedBlocksOnRow(y)); //System.out.println(blocks.getSortedBlocksOnRow(y)); List blockList = blocks.getSortedBlocksOnRow(y); - System.out.println(" "+blockList); + //System.out.println(" "+blockList); markedBlocks.addAll(FindMatches(blockList)); } for (int x=0;x0) { + int minY=Integer.MAX_VALUE; List newClumpBlocks = new ArrayList(); newClumpBlocks.addAll(markedBlocks); for (Block b : markedBlocks) { b.state = BlockState.IGNITED; //All blocks above marked blocks now join the clump. newClumpBlocks.addAll(blocks.getSortedBlocksOnCol(b.x).stream().filter((block)->!newClumpBlocks.contains(block)&&block.y>b.y).collect(Collectors.toList())); + minY=Math.min(minY,b.y); } //For now just get rid of them. blocks.removeBlock(newClumpBlocks.toArray(new Block[newClumpBlocks.size()])); + for (Block b : newClumpBlocks) { + b.y-=minY; + } + blockClumpAddList.add( + new BlockClump(newClumpBlocks, blocks.x, blocks.y+minY*block_height, launch_power, width, 120) + ); } - return false; + return markedBlocks.size()>0; } private List FindMatches(List blockList) { List markedBlocks = new ArrayList(); @@ -201,6 +216,11 @@ public class Board { blocks.launched--; } else if (blocks.launched==0) { + for (Block b : blocks.getBlocks()) { + if (b.state==BlockState.IGNITED) { + b.state=STARTINGSTATES[(int)(Meteo.r.nextInt(3))]; + } + } SplitBlockClump(blocks); } } diff --git a/src/sig/Meteo.java b/src/sig/Meteo.java index 33eb8f0..c43c5da 100644 --- a/src/sig/Meteo.java +++ b/src/sig/Meteo.java @@ -1,7 +1,5 @@ package sig; -import java.util.ArrayList; -import java.util.List; import java.util.Random; import javax.swing.JFrame; @@ -27,7 +25,7 @@ public class Meteo { public static void main(String[] args) { r = new Random(437210983125739812l); double[] val = {0,0,}; - b = new Board(SCREEN_WIDTH/2,SCREEN_HEIGHT/2,24,24,8,14,-0.065,1,4,-2,val); + b = new Board(SCREEN_WIDTH/2,SCREEN_HEIGHT/2,24,24,8,14,-0.065,5,4,-2,val); JFrame f = new JFrame("Meteo Engine"); Panel p = new Panel();