From b0d578a6861db0da03c7b3334acf65ed8497b973 Mon Sep 17 00:00:00 2001 From: Zach Jordan Date: Tue, 30 May 2023 08:37:20 -0400 Subject: finished level metadata file reading. --- levels/testLevel/metadata.json | 9 ++++++++- src/main/Level.java | 27 ++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/levels/testLevel/metadata.json b/levels/testLevel/metadata.json index eff28b2..b055416 100644 --- a/levels/testLevel/metadata.json +++ b/levels/testLevel/metadata.json @@ -1,5 +1,12 @@ { "title": "testSong", "artist": "ed sheeran", - "desc": "this is a test level. lalalala testing testing" + "desc": "this is a test level. lalalala testing testing", + + "color1": "#ffae00", + "color2": "#264630", + "color3": "#3b77d6", + "color4": "#f0bd07", + "color5": "#c2e7ff" + } \ No newline at end of file diff --git a/src/main/Level.java b/src/main/Level.java index 2e97367..66fe243 100644 --- a/src/main/Level.java +++ b/src/main/Level.java @@ -21,7 +21,12 @@ public class Level public ArrayList diffList = new ArrayList(); public Image background; //optional - public Color[] colors = new Color[]{Color.RED,Color.BLUE,Color.GREEN,Color.PURPLE,Color.YELLOW};//optional, have default colors + public Color[] colors;//optional, have default colors + public Color c1; + public Color c2; + public Color c3; + public Color c4; + public Color c5; private JSONObject levelStuff; @@ -54,9 +59,25 @@ public class Level artist = (String)(levelStuff.get("artist")); desc = (String)(levelStuff.get("desc")); - if(( levelStuff).containsKey("color1")) + if(( levelStuff).containsKey("color1")) //check for custom colors in a hexadecimal format { - + colors = new Color[5]; + + c1 = Color.web((String)(levelStuff.get("color1"))); //read in all the custom colors + c2 = Color.web((String)(levelStuff.get("color2"))); + c3 = Color.web((String)(levelStuff.get("color3"))); + c4 = Color.web((String)(levelStuff.get("color4"))); + c5 = Color.web((String)(levelStuff.get("color5"))); + + colors[0] = c1; + colors[1] = c2; + colors[2] = c3; + colors[3] = c4; + colors[4] = c5; + } + else + { + colors = new Color[]{Color.RED,Color.BLUE,Color.GREEN,Color.PURPLE,Color.YELLOW}; } } catch (FileNotFoundException e) -- cgit v1.2.3 From 0795c44d8e523bfd96671576f70d67d6184a1ede Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 30 May 2023 08:39:07 -0400 Subject: added music to file reader --- src/main/Difficulty.java | 2 ++ src/main/LevelController.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java index 7955698..24480e4 100644 --- a/src/main/Difficulty.java +++ b/src/main/Difficulty.java @@ -11,6 +11,8 @@ public class Difficulty private ObservableList leaderboard = FXCollections.observableArrayList(); public File notes; public int bpm; + public File song; + public int numBeats; public void parseMetadata(File file) { //hi zach put json reader stuff here diff --git a/src/main/LevelController.java b/src/main/LevelController.java index f4d7587..faa5bf4 100644 --- a/src/main/LevelController.java +++ b/src/main/LevelController.java @@ -33,6 +33,10 @@ public class LevelController { diff.notes = curFileInCurDiff; } + if (curFileInCurDiff.getName().equals("song.wav")) + { + diff.song = curFileInCurDiff; + } } level.diffList.add(diff); } -- cgit v1.2.3 From d283ab67988fe1c7f63b27c70077d3b599171d07 Mon Sep 17 00:00:00 2001 From: sowgro Date: Tue, 30 May 2023 08:44:24 -0400 Subject: comment --- src/gameplay/SongPlayer.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gameplay/SongPlayer.java b/src/gameplay/SongPlayer.java index 67b21a4..c770b8a 100644 --- a/src/gameplay/SongPlayer.java +++ b/src/gameplay/SongPlayer.java @@ -32,6 +32,10 @@ import sound.AudioFilePlayer; // gui.Driver.setMenu(new GameOver(lvl, d, p, cntrl.getScore())); +//d.numBeats - int +//d.song - File + + public class SongPlayer extends Pane { private int bpm; //initializes the bpm of the song, to be read in from a metadata file later Timer timer; //the timer that determines when notes will fall, counted in terms of the song's bpm -- cgit v1.2.3