diff --git a/core/src/com/me/brickbuster/entity/Brick.java b/core/src/com/me/brickbuster/entity/Brick.java index 8092e84..504a569 100644 --- a/core/src/com/me/brickbuster/entity/Brick.java +++ b/core/src/com/me/brickbuster/entity/Brick.java @@ -4,24 +4,32 @@ import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType; import com.badlogic.gdx.math.Vector2; -import com.me.brickbuster.entity.powerup.PowerUp; import com.me.brickbuster.entity.powerup.PowerUpType; import com.me.brickbuster.state.PlayState; public class Brick extends Entity { - public static final Color BLOCK_COLOR = Color.FOREST; + public static final Color DEFAULT_COLOR = Color.FOREST; public static final int BRICK_WIDTH = 200; public static final int BRICK_HEIGHT = 100; private PowerUpType powerUpType; + private Color color; private Vector2[] vertices; public Brick(PlayState state, PowerUpType powerUpType, int x, int y) { + this(state, powerUpType, true, x, y); + } + + public Brick(PlayState state, PowerUpType powerUpType, boolean hidePowerup, int x, int y) { + this(state, powerUpType, DEFAULT_COLOR, hidePowerup, x, y); + } + + public Brick(PlayState state, PowerUpType powerUpType, Color color, boolean hidePowerUp, int x, int y) { super(state, x, y); this.powerUpType = powerUpType; - + this.color = powerUpType != null && !hidePowerUp? powerUpType.getColor() : color; this.vertices = new Vector2[] { new Vector2(x, y), new Vector2(x + BRICK_WIDTH, y), @@ -33,7 +41,7 @@ public class Brick extends Entity { @Override public void render(ShapeRenderer sr) { sr.begin(ShapeType.Filled); - sr.setColor(BLOCK_COLOR); + sr.setColor(color); sr.rect(getX(), getY(), BRICK_WIDTH, BRICK_HEIGHT); sr.end(); } diff --git a/core/src/com/me/brickbuster/entity/powerup/PowerUpType.java b/core/src/com/me/brickbuster/entity/powerup/PowerUpType.java index 284ff40..415dbcb 100644 --- a/core/src/com/me/brickbuster/entity/powerup/PowerUpType.java +++ b/core/src/com/me/brickbuster/entity/powerup/PowerUpType.java @@ -8,9 +8,9 @@ import com.me.brickbuster.state.PlayState; public enum PowerUpType { - GLUE(GluePowerUp.class, Color.WHITE, 30), + GLUE(GluePowerUp.class, Color.WHITE, 20), LONGER_PADDLE(LongerPaddlePowerUp.class, Color.OLIVE, 40), - MULTI_BALL(MultiBallPowerUp.class, Color.ROYAL, 20), + MULTI_BALL(MultiBallPowerUp.class, Color.ROYAL, 30), SHIELD(ShieldPowerUp.class, Color.SALMON, 40), ;