aboutsummaryrefslogtreecommitdiff
path: root/src/gameplay
diff options
context:
space:
mode:
authorAidan Ross <aross02@fairport.org>2023-06-03 02:54:48 -0400
committerAidan Ross <aross02@fairport.org>2023-06-03 02:54:48 -0400
commit1c82de21d4fd3833c5b46245e182f53016403d3b (patch)
treea4800e55406340e9724740c740fad0c91fc18abf /src/gameplay
parentf3bc2ec111c4c74063261c324f39304c291b9f4c (diff)
downloadNPEhero-1c82de21d4fd3833c5b46245e182f53016403d3b.tar.gz
NPEhero-1c82de21d4fd3833c5b46245e182f53016403d3b.tar.bz2
NPEhero-1c82de21d4fd3833c5b46245e182f53016403d3b.zip
Background switching for songs, and a little bit of testing with the level editor
Diffstat (limited to 'src/gameplay')
-rw-r--r--src/gameplay/SongPlayer.java8
1 files changed, 7 insertions, 1 deletions
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());