Block merging from the bottom complete

concurrentModificationException1
sigonasr2, Sig, Sigo 3 years ago
parent 58ea5d6bfb
commit d41e25cb8e
  1. BIN
      Meteo_Engine.jar
  2. 15
      src/sig/BlockClump.java
  3. 8
      src/sig/Board.java
  4. 1
      src/sig/DebugMode.java
  5. 2
      src/sig/Meteo.java

Binary file not shown.

@ -7,7 +7,7 @@ import java.util.List;
import java.awt.Color;
public class BlockClump {
private List<Block> blocks;
private List<Block> blocks = new ArrayList<Block>();
double x,y; //the lower-left origin of this block clump. Every block positions relative to this.
double yspd;
int[][] collisionColumnRanges;
@ -16,9 +16,7 @@ public class BlockClump {
Positive is used for how much landing launch time before being split and falling.*/
public BlockClump(List<Block> blockList, double x, double y, double startspd, int width, int launched) {
this.blocks = new ArrayList<Block>();
this.blocks.addAll(blockList);
collisionColumnRanges = new int[width][];
collisionColumnRanges = new int[width][];
for (int i=0;i<width;i++) {
collisionColumnRanges[i] = new int[]{-1,-1};
@ -42,7 +40,10 @@ public class BlockClump {
}
public void addBlock(Block...blocks) {
//Adds the block to the strucutre. Update collision column ranges to reflect the new bounds.
for (Block b : blocks) {updateBlockCollisionRangeWithBlock(b);}
for (Block b : blocks)
{updateBlockCollisionRangeWithBlock(b);
this.blocks.add(b);
}
}
public void drawBlocks(Graphics g, int originX, int originY, int block_width, int block_height) {
for (Block b : blocks) {
@ -50,7 +51,7 @@ public class BlockClump {
}
}
public void drawClumpOutlines(Graphics g, int originX, int originY, int block_width, int block_height) {
if (Meteo.DEBUG_DRAWING==DebugMode.MODE0) {
if (Meteo.DEBUG_DRAWING==DebugMode.MODE0||Meteo.DEBUG_DRAWING==DebugMode.MODE1) {
g.setColor(new Color(0,255,0,128));
for (int i=0;i<collisionColumnRanges.length;i++) {
if (collisionColumnRanges[i][0]!=-1) {
@ -61,7 +62,7 @@ public class BlockClump {
}
}
public void drawClumpDots(Graphics g, int originX, int originY, int block_width, int block_height) {
if (Meteo.DEBUG_DRAWING==DebugMode.MODE0) {
if (Meteo.DEBUG_DRAWING==DebugMode.MODE0||Meteo.DEBUG_DRAWING==DebugMode.MODE1) {
g.setColor(Color.RED);
g.drawOval((int)x+originX,(int)-y+originY,2,2);
}

@ -59,9 +59,9 @@ public class Board {
blockData.add(defaultClump2);
}
public void run(long frames) {
/*if (frames%100==0) {
if (frames%100==0) {
blockData.add(new BlockClump(Arrays.asList(new Block((int)(Math.random()*width),0)),0,590,0,width,-1));
}*/
}
outerloop:
for (BlockClump blocks : blockData) {
@ -108,6 +108,10 @@ public class Board {
}
}
private void CombineAToB(BlockClump A, BlockClump B) {
for (Block b : A.getBlocks()) {
b.y = B.collisionColumnRanges[b.x][1]+1;
B.addBlock(b);
}
blockClumpDeleteList.add(A);
}
private void HandleBlockLand(BlockClump blocks, int x, double yset) {

@ -3,4 +3,5 @@ package sig;
public enum DebugMode {
OFF,
MODE0, //Displays blocks ready for connecting in black and block clumps with green rectangles.
MODE1, //Displays block clumps with green rectangles only.
}

@ -15,7 +15,7 @@ public class Meteo {
public static Board b;
public final static long TIMEPERTICK = 16666667l;
public static DebugMode DEBUG_DRAWING = DebugMode.MODE0;
public static DebugMode DEBUG_DRAWING = DebugMode.MODE1;
public static void runGameLoop() {
FRAMECOUNT++;

Loading…
Cancel
Save