diff options
| author | Aidan Ross <aross02@fairport.org> | 2023-06-05 08:35:22 -0400 | 
|---|---|---|
| committer | Aidan Ross <aross02@fairport.org> | 2023-06-05 08:35:22 -0400 | 
| commit | c0e5adb06fa5076ae1f024f004605f7f4e442957 (patch) | |
| tree | acd8c10309f96216802f55dfdef4bedf4ab8695d /src | |
| parent | fc23e12aa682298a6845d0085f1d39dae1d9c5b6 (diff) | |
| download | NPEhero-c0e5adb06fa5076ae1f024f004605f7f4e442957.tar.gz NPEhero-c0e5adb06fa5076ae1f024f004605f7f4e442957.tar.bz2 NPEhero-c0e5adb06fa5076ae1f024f004605f7f4e442957.zip  | |
Syncing Issues fixed and added Q as a beat timer in the terminal.
Diffstat (limited to '')
| -rw-r--r-- | src/gameplay/SongPlayer.java | 15 | 
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gameplay/SongPlayer.java b/src/gameplay/SongPlayer.java index 3e465bd..13b2b72 100644 --- a/src/gameplay/SongPlayer.java +++ b/src/gameplay/SongPlayer.java @@ -44,6 +44,9 @@ public class SongPlayer extends Pane {  	private Double bpm;		//initializes the bpm of the song, to be read in from a metadata file later  	private int songLength; //initializes the length of the song in terms of the song's bpm, to be read in later +	private File song; +	private boolean songIsPlaying = false; +  	private main.Level level;  	private Difficulty difficulty;  	private Pane pane; @@ -107,8 +110,8 @@ public class SongPlayer extends Pane {  	}  	public SongPlayer(main.Level lvl, Difficulty d, Pane p, ScoreController cntrl) { - -		Driver.soundController.playSong(lvl.song); +		Driver.soundController.endSong(); +		song = lvl.song;  		if (lvl.background != null) {  			Driver.setBackground(lvl.background.getUrl()); @@ -162,6 +165,9 @@ public class SongPlayer extends Pane {  			if (e.getCode() == KeyCode.K) {  				checkNote(kLane, kButton);  			} +			if (e.getCode() == KeyCode.Q) { +				System.out.println("" + timer.time()); +			}  			//prints the user's current score and combo, for debugging purposes  			//System.out.println("Score: " + scoreCounter.getScore() + "\nCombo: " + scoreCounter.getCombo() + "\n");  		}); @@ -252,7 +258,9 @@ public class SongPlayer extends Pane {  				gui.Driver.setMenu(new GameOver(level, difficulty, pane, scoreCounter.getScore()));  				cancel();	  			} -			if (timer.time() > 0.0) { +			if (!songIsPlaying && timer.time() > 0.0) { +				songIsPlaying = true; +				Driver.soundController.playSong(song);  			}  		}  	}; @@ -270,6 +278,7 @@ public class SongPlayer extends Pane {  	 * @throws UnsupportedAudioFileException  	 */  	public void cancel() { +		Driver.soundController.playMenuSong();  		gui.Driver.setBackground("assets/forest.png");  		gameLoop.stop();  		Driver.soundController.endSong();  | 
