Skip to content
Snippets Groups Projects
Commit 1b9e5287 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

implemented explosive ball

parent d142c558
Branches
Tags
No related merge requests found
......@@ -2,6 +2,8 @@ package de.bricked.game.board;
import java.util.ArrayList;
import de.bricked.game.balls.Ball;
import de.bricked.game.balls.BallType;
import de.bricked.game.bricks.Brick;
import de.bricked.game.bricks.BrickType;
import de.bricked.game.levels.Level;
......@@ -151,11 +153,22 @@ public class Board
return HEIGHT;
}
public int hitBrick(int row, int col, boolean instantDestroy)
public int hitBrick(int row, int col, Ball ball)
{
points = 0;
destroyBrick(row, col, instantDestroy);
if(ball.getType().equals(BallType.EXPLOSIVE))
{
Brick currentBrick = bricks.get(row).get(col);
if(currentBrick.getPowerUp() != null)
{
//TODO deploy PowerUp
}
bricks.get(row).set(col, new Brick(BrickType.TNT));
}
destroyBrick(row, col, false);
return points;
}
......
......@@ -607,7 +607,7 @@ public class LevelController
{
anchorPaneGame.getChildren().remove(stackPaneBall);
game.setBall(new Ball(BallType.NO_COLLISION));
game.setBall(new Ball(BallType.EXPLOSIVE));
// create circle for ball
final Circle circle = new Circle(game.getBall().getBallRadius(), Color.web(game.getBall().getType().getColor()));
......@@ -661,7 +661,7 @@ public class LevelController
correctBallPosition(hitLocation, ballPosition, brickPosition, stackPaneBrick.getWidth(), stackPaneBrick.getHeight());
game.setPoints(game.getPoints() + game.getBoard().hitBrick(i, k, false));
game.setPoints(game.getPoints() + game.getBoard().hitBrick(i, k, game.getBall()));
labelPoints.setText(String.valueOf(game.getPoints()));
labelBlocksRemaining.setText(game.getBoard().getNumberOfRemainingBricks() + " Bricks remaining");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment