Altered powerup weights (decreased glue, increased multi ball)
Allow bricks to have their colour changed.
This commit is contained in:
parent
ea6240bd2c
commit
e2c0bad9e0
@ -4,24 +4,32 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
|
||||||
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
|
||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.me.brickbuster.entity.powerup.PowerUp;
|
|
||||||
import com.me.brickbuster.entity.powerup.PowerUpType;
|
import com.me.brickbuster.entity.powerup.PowerUpType;
|
||||||
import com.me.brickbuster.state.PlayState;
|
import com.me.brickbuster.state.PlayState;
|
||||||
|
|
||||||
public class Brick extends Entity {
|
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_WIDTH = 200;
|
||||||
public static final int BRICK_HEIGHT = 100;
|
public static final int BRICK_HEIGHT = 100;
|
||||||
|
|
||||||
private PowerUpType powerUpType;
|
private PowerUpType powerUpType;
|
||||||
|
private Color color;
|
||||||
|
|
||||||
private Vector2[] vertices;
|
private Vector2[] vertices;
|
||||||
|
|
||||||
public Brick(PlayState state, PowerUpType powerUpType, int x, int y) {
|
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);
|
super(state, x, y);
|
||||||
this.powerUpType = powerUpType;
|
this.powerUpType = powerUpType;
|
||||||
|
this.color = powerUpType != null && !hidePowerUp? powerUpType.getColor() : color;
|
||||||
this.vertices = new Vector2[] {
|
this.vertices = new Vector2[] {
|
||||||
new Vector2(x, y),
|
new Vector2(x, y),
|
||||||
new Vector2(x + BRICK_WIDTH, y),
|
new Vector2(x + BRICK_WIDTH, y),
|
||||||
@ -33,7 +41,7 @@ public class Brick extends Entity {
|
|||||||
@Override
|
@Override
|
||||||
public void render(ShapeRenderer sr) {
|
public void render(ShapeRenderer sr) {
|
||||||
sr.begin(ShapeType.Filled);
|
sr.begin(ShapeType.Filled);
|
||||||
sr.setColor(BLOCK_COLOR);
|
sr.setColor(color);
|
||||||
sr.rect(getX(), getY(), BRICK_WIDTH, BRICK_HEIGHT);
|
sr.rect(getX(), getY(), BRICK_WIDTH, BRICK_HEIGHT);
|
||||||
sr.end();
|
sr.end();
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,9 @@ import com.me.brickbuster.state.PlayState;
|
|||||||
|
|
||||||
public enum PowerUpType {
|
public enum PowerUpType {
|
||||||
|
|
||||||
GLUE(GluePowerUp.class, Color.WHITE, 30),
|
GLUE(GluePowerUp.class, Color.WHITE, 20),
|
||||||
LONGER_PADDLE(LongerPaddlePowerUp.class, Color.OLIVE, 40),
|
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),
|
SHIELD(ShieldPowerUp.class, Color.SALMON, 40),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user