Refactor powerups, move to new package. Decrease long paddle chance to 8%

This commit is contained in:
Matt Low 2018-11-12 11:33:22 +04:00
parent 88428fded9
commit d3eb876960
5 changed files with 13 additions and 4 deletions

View File

@ -6,6 +6,9 @@ import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.math.Vector2;
import com.me.brickbuster.entity.*;
import com.me.brickbuster.entity.powerup.GluePowerUp;
import com.me.brickbuster.entity.powerup.LongerPaddlePowerUp;
import com.me.brickbuster.entity.powerup.PowerUp;
import java.util.ArrayList;
import java.util.Iterator;
@ -39,7 +42,7 @@ public class BrickBuster extends ApplicationAdapter {
if (MathUtils.randomBoolean(0.08f)) {
powerUpType = GluePowerUp.class;
}
else if (MathUtils.randomBoolean(0.25f)) {
else if (MathUtils.randomBoolean(0.08f)) {
powerUpType = LongerPaddlePowerUp.class;
}
bricks.add(new Brick(this, powerUpType, x, HEIGHT - y));

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;
import com.badlogic.gdx.math.Vector2;
import com.me.brickbuster.BrickBuster;
import com.me.brickbuster.entity.powerup.PowerUp;
public class Brick extends Entity {
public static final Color BLOCK_COLOR = Color.FOREST;

View File

@ -1,7 +1,8 @@
package com.me.brickbuster.entity;
package com.me.brickbuster.entity.powerup;
import com.badlogic.gdx.graphics.Color;
import com.me.brickbuster.BrickBuster;
import com.me.brickbuster.entity.Brick;
public class GluePowerUp extends PowerUp {

View File

@ -1,7 +1,9 @@
package com.me.brickbuster.entity;
package com.me.brickbuster.entity.powerup;
import com.badlogic.gdx.graphics.Color;
import com.me.brickbuster.BrickBuster;
import com.me.brickbuster.entity.Brick;
import com.me.brickbuster.entity.Paddle;
public class LongerPaddlePowerUp extends PowerUp {
public LongerPaddlePowerUp(BrickBuster brickBuster, Brick brick) {

View File

@ -1,10 +1,12 @@
package com.me.brickbuster.entity;
package com.me.brickbuster.entity.powerup;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.math.Vector2;
import com.me.brickbuster.BrickBuster;
import com.me.brickbuster.Utils;
import com.me.brickbuster.entity.Brick;
import com.me.brickbuster.entity.Entity;
import net.dermetfan.utils.Pair;
public abstract class PowerUp extends Entity {