diff options
| author | Zach Jordan <zxjordan5@gmail.com> | 2023-05-30 08:37:20 -0400 | 
|---|---|---|
| committer | Zach Jordan <zxjordan5@gmail.com> | 2023-05-30 08:37:20 -0400 | 
| commit | b0d578a6861db0da03c7b3334acf65ed8497b973 (patch) | |
| tree | d5a22df71b3db58923a99d18b50480457ff109ad /src | |
| parent | 0072477c3b18edefae34e0b634436aeecb625b10 (diff) | |
| download | NPEhero-b0d578a6861db0da03c7b3334acf65ed8497b973.tar.gz NPEhero-b0d578a6861db0da03c7b3334acf65ed8497b973.tar.bz2 NPEhero-b0d578a6861db0da03c7b3334acf65ed8497b973.zip  | |
finished level metadata file reading.
Diffstat (limited to '')
| -rw-r--r-- | src/main/Level.java | 27 | 
1 files changed, 24 insertions, 3 deletions
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<Difficulty> diffList = new ArrayList<Difficulty>();      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)   | 
