package sig; import java.awt.Graphics; import java.awt.Color; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class Board { List blockData; int width; int height; double gravity; double launch_power; double max_rise_spd; double max_fall_spd; double[] combo_power_bonus; int x,y; int block_width,block_height; double vspeed; public Board(int centerX,int centerY,int block_width,int block_height,int boardWidth, int boardHeight, double gravity, double launch_power, double max_rise_spd, double max_fall_spd, double[] combo_power_bonus) { this.x=centerX; this.y=centerY; this.block_width=block_width; this.block_height=block_height; this.width = boardWidth; this.height = boardHeight; this.gravity = gravity; this.launch_power = launch_power; this.max_rise_spd = max_rise_spd; this.max_fall_spd = max_fall_spd; this.combo_power_bonus = combo_power_bonus; this.blockData = new ArrayList(); List initialBlocks = new ArrayList(); for (int x=0;x initialBlocks2 = new ArrayList(); for (int x=0;xblocks2.y+(blocks2.collisionColumnRanges[x][0]+1)*block_height) { HandleBlockLand(blocks, x, blocks2.y+(blocks2.collisionColumnRanges[x][0]+1)*block_height); continue outerloop; } } else { if (FUTURE_FALL_POSITION+blocks.collisionColumnRanges[x][0]*block_height0) { blocks.yspd=Math.max(blocks.yspd+gravity,max_fall_spd); blocks.y+=blocks.yspd; } else { //We have hit the bottom. blocks.yspd=0; blocks.y=0; } //System.out.println(blocks.y); } } private void HandleBlockLand(BlockClump blocks, int x, double yset) { blocks.yspd=0; blocks.y=yset; } public void drawBoard(Graphics g) { final int DRAW_STARTX = (int)(x - block_width*((double)width/2)); final int DRAW_STARTY = (int)(y + block_height*((double)height/2)); final int DRAW_ENDX = (int)(x + block_width*((double)width/2)); for (BlockClump bc : blockData) { bc.drawBlocks(g,DRAW_STARTX,DRAW_STARTY,block_width,block_height); } g.setColor(Color.BLACK); g.fillRoundRect(DRAW_STARTX, DRAW_STARTY+block_height, DRAW_ENDX-DRAW_STARTX, 3, 3, 1); } }