From c94726840b869a41ea82f0d69e163a260c433c79 Mon Sep 17 00:00:00 2001 From: sowgro Date: Mon, 5 Jun 2023 23:15:13 -0400 Subject: improve level surround contrast, add key labels --- src/gameplay/SongPlayer.java | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/gameplay/SongPlayer.java') diff --git a/src/gameplay/SongPlayer.java b/src/gameplay/SongPlayer.java index 3d3fe7d..a1a6b45 100644 --- a/src/gameplay/SongPlayer.java +++ b/src/gameplay/SongPlayer.java @@ -59,23 +59,23 @@ public class SongPlayer extends Pane { HBox buttonBox = new HBox(); //used to align the buttons horizontally VBox place = new VBox(); //used to place the buttons within the frame - TButton dButton = new TButton(Color.RED, 50, 50, 5); //Initializes the button, each parameter is a placeholder that is changed later + Target dButton = new Target(Color.RED, 50, 50, 5, 'd'); //Initializes the button, each parameter is a placeholder that is changed later Queue dSends = new LinkedList(); //Queue that dictates when to send the notes ArrayList dLane = new ArrayList(); //Array list containing all the notes currently on the field for that lane //process is repeated for the following four buttons - TButton fButton = new TButton(Color.BLUE, 50, 50, 5); + Target fButton = new Target(Color.BLUE, 50, 50, 5, 'f'); Queue fSends = new LinkedList(); ArrayList fLane = new ArrayList(); - TButton sButton = new TButton(Color.GREEN, 50, 50, 5); + Target sButton = new Target(Color.GREEN, 50, 50, 5, '_'); Queue spaceSends = new LinkedList(); ArrayList spaceLane = new ArrayList(); - TButton jButton = new TButton(Color.PURPLE, 50, 50, 5); + Target jButton = new Target(Color.PURPLE, 50, 50, 5, 'j'); Queue jSends = new LinkedList(); ArrayList jLane = new ArrayList(); - TButton kButton = new TButton(Color.YELLOW, 50, 50, 5); + Target kButton = new Target(Color.YELLOW, 50, 50, 5, 'k'); Queue kSends = new LinkedList(); ArrayList kLane = new ArrayList(); @@ -197,7 +197,7 @@ public class SongPlayer extends Pane { * @param pos the x pos of the note to be sent * @param c the color of the sent note */ - public void sendNote(Queue sends, ArrayList lane, TButton button) { + public void sendNote(Queue sends, ArrayList lane, Target button) { if (sends.peek() != null && timer.time() > sends.peek().getTime()-(1000*(bpm/60000.0))) { TranslateTransition anim = new TranslateTransition(Duration.millis(TIME+60)); @@ -219,7 +219,7 @@ public class SongPlayer extends Pane { anim.setOnFinished(e -> { if (super.getChildren().removeAll(anim.getNode())){ scoreCounter.miss(); - FillTransition ft = new FillTransition(Duration.millis(500), button); + FillTransition ft = new FillTransition(Duration.millis(500), button.rect); ft.setFromValue(Color.RED); ft.setToValue(button.getFillColor()); ft.play(); @@ -234,12 +234,12 @@ public class SongPlayer extends Pane { * * @param button */ - private void genButton(TButton button) { - button.heightProperty().bind(super.widthProperty().divide(8)); - button.widthProperty().bind(super.widthProperty().divide(8)); - button.arcHeightProperty().bind(super.widthProperty().divide(25)); - button.arcWidthProperty().bind(super.widthProperty().divide(25)); - button.strokeWidthProperty().bind(super.widthProperty().divide(120)); + private void genButton(Target button) { + button.rect.heightProperty().bind(super.widthProperty().divide(8)); + button.rect.widthProperty().bind(super.widthProperty().divide(8)); + button.rect.arcHeightProperty().bind(super.widthProperty().divide(25)); + button.rect.arcWidthProperty().bind(super.widthProperty().divide(25)); + button.rect.strokeWidthProperty().bind(super.widthProperty().divide(120)); } /** @@ -308,7 +308,7 @@ public class SongPlayer extends Pane { * @return */ private double distanceToGoal(Block note) { - return Math.abs((super.getHeight() - note.getTranslateY()) - dButton.getY()); + return Math.abs((super.getHeight() - note.getTranslateY()) - dButton.rect.getY()); } /** @@ -317,13 +317,13 @@ public class SongPlayer extends Pane { * @param button the button checking for a hit * @return 2 for a perfect hit, 1 for a good hit, 0 for a miss, and -1 if there are no notes to hit */ - private int checkNote(ArrayList lane, TButton button) { + private int checkNote(ArrayList lane, Target button) { if (lane.size() != 0) { double distance = distanceToGoal(lane.get(getClosestNote(lane))); if (lane.size() > 0 && distance < super.getHeight() / 3) { - FillTransition ft = new FillTransition(Duration.millis(500), button); + FillTransition ft = new FillTransition(Duration.millis(500), button.rect); ft.setToValue(button.getFillColor()); super.getChildren().removeAll(lane.get(getClosestNote(lane))); -- cgit v1.2.3