Decreased brick size, increased edge padding, removed brick padding

Field is now 11 bricks wide instead of 10
Extended edge padding to Y=0
This commit is contained in:
Matt Low 2018-11-21 14:06:01 +04:00
parent 2a40bcabdf
commit 3fdd394e36
4 changed files with 9 additions and 11 deletions

View File

@ -22,8 +22,8 @@ import com.me.brickbuster.state.PlayState;
public class Brick extends Entity implements PhysicsBody, CollisionListener { public class Brick extends Entity implements PhysicsBody, CollisionListener {
public static final float BRICK_WIDTH = 5f; public static final float BRICK_WIDTH = 4.6f;
public static final float BRICK_HEIGHT = 2.5f; public static final float BRICK_HEIGHT = 2.3f;
private static final EarClippingTriangulator ECT = new EarClippingTriangulator(); private static final EarClippingTriangulator ECT = new EarClippingTriangulator();
private static final Vector2 tmp = new Vector2(); private static final Vector2 tmp = new Vector2();
@ -79,7 +79,7 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener {
hitByBall = false; hitByBall = false;
} }
if (getY() - BRICK_HEIGHT < 0) { if (getY() + BRICK_HEIGHT < 0) {
delete(); delete();
} }
} }

View File

@ -14,7 +14,6 @@ public class GridLayout implements BrickLayout {
private final int cols; private final int cols;
private final int rows; private final int rows;
private final float powerUpChance; private final float powerUpChance;
private final float brick_padding;
private BrickShape.Shape shape = null; private BrickShape.Shape shape = null;
private BrickType type = null; private BrickType type = null;
@ -38,7 +37,6 @@ public class GridLayout implements BrickLayout {
this.state = state; this.state = state;
this.cols = cols; this.cols = cols;
this.rows = rows; this.rows = rows;
this.brick_padding = (PlayState.BOARD_WIDTH - cols * Brick.BRICK_WIDTH) / (cols + 1);
this.powerUpChance = powerUpChance; this.powerUpChance = powerUpChance;
this.shape = shape; this.shape = shape;
this.type = type; this.type = type;
@ -55,8 +53,8 @@ public class GridLayout implements BrickLayout {
} }
protected Brick getBrickForCell(int row, int col) { protected Brick getBrickForCell(int row, int col) {
final float x = brick_padding + Brick.BRICK_WIDTH/2 + (col * (Brick.BRICK_WIDTH + brick_padding)); final float x = PlayState.EDGE_PADDING + Brick.BRICK_WIDTH/2 + col * Brick.BRICK_WIDTH;
final float y = brick_padding + Brick.BRICK_HEIGHT/2 + (row * (Brick.BRICK_HEIGHT + brick_padding)); final float y = PlayState.EDGE_PADDING + Brick.BRICK_HEIGHT/2 + row * Brick.BRICK_HEIGHT;
PowerUpType powerUpType = null; PowerUpType powerUpType = null;
if (MathUtils.randomBoolean(powerUpChance)) { if (MathUtils.randomBoolean(powerUpChance)) {

View File

@ -5,7 +5,7 @@ import com.me.brickbuster.state.PlayState;
public class GridLevelLoader implements LevelLoader { public class GridLevelLoader implements LevelLoader {
public static final float POWER_UP_CHANCE = 0.15f; public static final float POWER_UP_CHANCE = 0.15f;
public static final int COLUMNS = 10; public static final int COLUMNS = 11;
public static final int ROWS = 20; public static final int ROWS = 20;
public static final int ROUNDS = 2; public static final int ROUNDS = 2;

View File

@ -19,12 +19,12 @@ public class PlayState extends FieldState {
public static final float PIXEL_PER_METER = 40f; // Board dimension: 54x96 meters public static final float PIXEL_PER_METER = 40f; // Board dimension: 54x96 meters
public static final float BOARD_WIDTH = 54f; public static final float BOARD_WIDTH = 54f;
public static final float BOARD_HEIGHT = 96f; public static final float BOARD_HEIGHT = 96f;
public static final float EDGE_PADDING = .125f; public static final float EDGE_PADDING = 1.7f;
public static final Vector2 lowerLeftCorner = public static final Vector2 lowerLeftCorner =
new Vector2(EDGE_PADDING,EDGE_PADDING); new Vector2(EDGE_PADDING,0);
public static final Vector2 lowerRightCorner = public static final Vector2 lowerRightCorner =
new Vector2(BrickBuster.BOARD_WIDTH/PIXEL_PER_METER-EDGE_PADDING,EDGE_PADDING); new Vector2(BrickBuster.BOARD_WIDTH/PIXEL_PER_METER-EDGE_PADDING,0);
public static final Vector2 upperRightCorner = public static final Vector2 upperRightCorner =
new Vector2(BrickBuster.BOARD_WIDTH/PIXEL_PER_METER-EDGE_PADDING, BrickBuster.BOARD_HEIGHT/PIXEL_PER_METER-EDGE_PADDING); new Vector2(BrickBuster.BOARD_WIDTH/PIXEL_PER_METER-EDGE_PADDING, BrickBuster.BOARD_HEIGHT/PIXEL_PER_METER-EDGE_PADDING);
public static final Vector2 upperLeftCorner = public static final Vector2 upperLeftCorner =