From 1c82de21d4fd3833c5b46245e182f53016403d3b Mon Sep 17 00:00:00 2001 From: Aidan Ross Date: Sat, 3 Jun 2023 02:54:48 -0400 Subject: Background switching for songs, and a little bit of testing with the level editor --- src/assets/Hitsound.wav | Bin 34820 -> 34820 bytes src/gameplay/SongPlayer.java | 8 +++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/assets/Hitsound.wav b/src/assets/Hitsound.wav index 3dd280d..b9463a2 100644 Binary files a/src/assets/Hitsound.wav and b/src/assets/Hitsound.wav differ diff --git a/src/gameplay/SongPlayer.java b/src/gameplay/SongPlayer.java index ccd34ea..985e5fb 100644 --- a/src/gameplay/SongPlayer.java +++ b/src/gameplay/SongPlayer.java @@ -12,6 +12,7 @@ import java.util.Scanner; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; +import gui.Driver; import gui.GameOver; import javafx.geometry.Pos; import javafx.scene.input.KeyCode; @@ -120,6 +121,9 @@ public class SongPlayer extends Pane { new MediaView(gui.Driver.mediaPlayer); + if (lvl.background != null) { + Driver.setBackground(lvl.background.getUrl()); + } bpm = d.bpm; //Reads the song's bpm from a metadata file level = lvl; difficulty = d; @@ -153,6 +157,7 @@ public class SongPlayer extends Pane { * The keyboard detection for the game: when a key is pressed it * calls the checkNote() method for the corresponding lane */ + System.out.println(timer.time()); if (e.getCode() == KeyCode.D) { checkNote(dLane, dButton); } @@ -239,7 +244,7 @@ public class SongPlayer extends Pane { button.widthProperty().bind(super.widthProperty().divide(8)); button.arcHeightProperty().bind(super.widthProperty().divide(25)); button.arcWidthProperty().bind(super.widthProperty().divide(25)); - button.setStrokeWidth(3); + button.strokeWidthProperty().bind(super.widthProperty().divide(120)); } /** @@ -277,6 +282,7 @@ public class SongPlayer extends Pane { * @throws UnsupportedAudioFileException */ public void cancel() { + gui.Driver.setBackground("assets/forest.png"); gameLoop.stop(); gui.Driver.mediaPlayer.stop(); Media song = new Media(Paths.get("src/assets/MenuMusicPlaceholder.wav").toUri().toString()); -- cgit v1.2.3