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

started implementing multiplicator display

parent b0234f81
No related branches found
No related tags found
No related merge requests found
......@@ -57,16 +57,11 @@
</Label>
</children>
</HBox>
<VBox fx:id="vboxLives" layoutX="745.0" layoutY="603.0" minHeight="71.0" minWidth="40.0" prefHeight="183.0" prefWidth="40.0" AnchorPane.bottomAnchor="24.0" AnchorPane.rightAnchor="15.0" />
<VBox fx:id="vboxLives" layoutX="745.0" layoutY="603.0" minHeight="71.0" minWidth="40.0" prefHeight="227.0" prefWidth="40.0" AnchorPane.bottomAnchor="24.0" AnchorPane.rightAnchor="15.0" />
<Label fx:id="labelFPS" layoutX="770.0" layoutY="6.0" text="0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="8.0">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<Label fx:id="labelMultiplicator" alignment="CENTER_RIGHT" layoutX="736.0" layoutY="543.0" prefHeight="30.0" prefWidth="49.0" text="x0" textAlignment="JUSTIFY" AnchorPane.rightAnchor="18.0" AnchorPane.topAnchor="543.0">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
</children>
</AnchorPane>
......@@ -70,7 +70,6 @@ public class LevelController
@FXML private VBox vboxPowerUps;
@FXML private VBox vboxLives;
@FXML private Label labelFPS;
@FXML private Label labelMultiplicator;
public Stage stage;
public Image icon = new Image("de/bricked/resources/icon.png");
......@@ -632,7 +631,6 @@ public class LevelController
game.applyMultiplicator();
game.resetMultiplicator();
game.resetPointsSinceLastMultiplicatorReset();
labelMultiplicator.setText("x0");
labelPoints.setText(String.valueOf(game.getTotalPoints()));
}
......@@ -640,7 +638,46 @@ public class LevelController
{
game.increaseMultiplicator();
game.increasePointsSinceLastMultiplicatorReset(points);
labelMultiplicator.setText("x" + game.getMultiplicator());
if(game.getMultiplicator() > 1)
{
double xPosition = (gamePaneWidth / Board.WIDTH) * (7);
double yPosition = (gamePaneHeight / Board.HEIGHT) * (20);
Label labelNotification = new Label("x" + game.getMultiplicator());
labelNotification.setTranslateX(xPosition);
labelNotification.setTranslateY(yPosition);
labelNotification.setStyle("-fx-font-weight: bold; -fx-font-size: 30; ");
labelNotification.setAlignment(Pos.CENTER);
labelNotification.setPrefWidth((gamePaneWidth / Board.WIDTH) * 3);
labelNotification.setPrefHeight((gamePaneHeight / Board.HEIGHT) * 2);
anchorPaneGame.getChildren().add(labelNotification);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(800), labelNotification);
fadeTransition.setFromValue(1.0);
fadeTransition.setToValue(0.0);
fadeTransition.setCycleCount(1);
fadeTransition.setAutoReverse(false);
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(800), labelNotification);
translateTransition.setFromY(yPosition);
translateTransition.setToY(yPosition - (gamePaneHeight / Board.HEIGHT) * 3);
translateTransition.setCycleCount(1);
translateTransition.setAutoReverse(false);
ParallelTransition parallelTransition = new ParallelTransition();
parallelTransition.getChildren().addAll(fadeTransition, translateTransition);
parallelTransition.setCycleCount(1);
parallelTransition.setOnFinished(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
anchorPaneGame.getChildren().remove(labelNotification);
}
});
parallelTransition.play();
}
}
private void movePaddleLeft()
......
......@@ -57,16 +57,11 @@
</Label>
</children>
</HBox>
<VBox fx:id="vboxLives" layoutX="745.0" layoutY="603.0" minHeight="71.0" minWidth="40.0" prefHeight="183.0" prefWidth="40.0" AnchorPane.bottomAnchor="24.0" AnchorPane.rightAnchor="15.0" />
<VBox fx:id="vboxLives" layoutX="745.0" layoutY="603.0" minHeight="71.0" minWidth="40.0" prefHeight="227.0" prefWidth="40.0" AnchorPane.bottomAnchor="24.0" AnchorPane.rightAnchor="15.0" />
<Label fx:id="labelFPS" layoutX="770.0" layoutY="6.0" text="0" AnchorPane.rightAnchor="8.0" AnchorPane.topAnchor="8.0">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<Label fx:id="labelMultiplicator" alignment="CENTER_RIGHT" layoutX="736.0" layoutY="543.0" prefHeight="30.0" prefWidth="49.0" text="x0" textAlignment="JUSTIFY" AnchorPane.rightAnchor="18.0" AnchorPane.topAnchor="543.0">
<font>
<Font name="System Bold" size="20.0" />
</font>
</Label>
</children>
</AnchorPane>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment