From 3fdd394e3629163518e9886a1fa98594eeb1cfff Mon Sep 17 00:00:00 2001 From: Matt Low Date: Wed, 21 Nov 2018 14:06:01 +0400 Subject: [PATCH] Decreased brick size, increased edge padding, removed brick padding Field is now 11 bricks wide instead of 10 Extended edge padding to Y=0 --- core/src/com/me/brickbuster/entity/Brick.java | 6 +++--- core/src/com/me/brickbuster/layout/GridLayout.java | 6 ++---- core/src/com/me/brickbuster/layout/GridLevelLoader.java | 2 +- core/src/com/me/brickbuster/state/PlayState.java | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/core/src/com/me/brickbuster/entity/Brick.java b/core/src/com/me/brickbuster/entity/Brick.java index f259c12..5b52fbc 100644 --- a/core/src/com/me/brickbuster/entity/Brick.java +++ b/core/src/com/me/brickbuster/entity/Brick.java @@ -22,8 +22,8 @@ import com.me.brickbuster.state.PlayState; public class Brick extends Entity implements PhysicsBody, CollisionListener { - public static final float BRICK_WIDTH = 5f; - public static final float BRICK_HEIGHT = 2.5f; + public static final float BRICK_WIDTH = 4.6f; + public static final float BRICK_HEIGHT = 2.3f; private static final EarClippingTriangulator ECT = new EarClippingTriangulator(); private static final Vector2 tmp = new Vector2(); @@ -79,7 +79,7 @@ public class Brick extends Entity implements PhysicsBody, CollisionListener { hitByBall = false; } - if (getY() - BRICK_HEIGHT < 0) { + if (getY() + BRICK_HEIGHT < 0) { delete(); } } diff --git a/core/src/com/me/brickbuster/layout/GridLayout.java b/core/src/com/me/brickbuster/layout/GridLayout.java index eec4df3..8bf4250 100644 --- a/core/src/com/me/brickbuster/layout/GridLayout.java +++ b/core/src/com/me/brickbuster/layout/GridLayout.java @@ -14,7 +14,6 @@ public class GridLayout implements BrickLayout { private final int cols; private final int rows; private final float powerUpChance; - private final float brick_padding; private BrickShape.Shape shape = null; private BrickType type = null; @@ -38,7 +37,6 @@ public class GridLayout implements BrickLayout { this.state = state; this.cols = cols; this.rows = rows; - this.brick_padding = (PlayState.BOARD_WIDTH - cols * Brick.BRICK_WIDTH) / (cols + 1); this.powerUpChance = powerUpChance; this.shape = shape; this.type = type; @@ -55,8 +53,8 @@ public class GridLayout implements BrickLayout { } protected Brick getBrickForCell(int row, int col) { - final float x = brick_padding + Brick.BRICK_WIDTH/2 + (col * (Brick.BRICK_WIDTH + brick_padding)); - final float y = brick_padding + Brick.BRICK_HEIGHT/2 + (row * (Brick.BRICK_HEIGHT + brick_padding)); + final float x = PlayState.EDGE_PADDING + Brick.BRICK_WIDTH/2 + col * Brick.BRICK_WIDTH; + final float y = PlayState.EDGE_PADDING + Brick.BRICK_HEIGHT/2 + row * Brick.BRICK_HEIGHT; PowerUpType powerUpType = null; if (MathUtils.randomBoolean(powerUpChance)) { diff --git a/core/src/com/me/brickbuster/layout/GridLevelLoader.java b/core/src/com/me/brickbuster/layout/GridLevelLoader.java index 80249f0..d9f8579 100644 --- a/core/src/com/me/brickbuster/layout/GridLevelLoader.java +++ b/core/src/com/me/brickbuster/layout/GridLevelLoader.java @@ -5,7 +5,7 @@ import com.me.brickbuster.state.PlayState; public class GridLevelLoader implements LevelLoader { 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 ROUNDS = 2; diff --git a/core/src/com/me/brickbuster/state/PlayState.java b/core/src/com/me/brickbuster/state/PlayState.java index 75bc2ce..92a4cd9 100644 --- a/core/src/com/me/brickbuster/state/PlayState.java +++ b/core/src/com/me/brickbuster/state/PlayState.java @@ -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 BOARD_WIDTH = 54f; 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 = - new Vector2(EDGE_PADDING,EDGE_PADDING); + new Vector2(EDGE_PADDING,0); 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 = new Vector2(BrickBuster.BOARD_WIDTH/PIXEL_PER_METER-EDGE_PADDING, BrickBuster.BOARD_HEIGHT/PIXEL_PER_METER-EDGE_PADDING); public static final Vector2 upperLeftCorner =