Skip to content

Commit

Permalink
Add credits level and time to beat level
Browse files Browse the repository at this point in the history
  • Loading branch information
RedTopper committed Aug 3, 2020
1 parent c38740e commit bc26267
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 1 deletion.
1 change: 1 addition & 0 deletions hexlevels/0hexagon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.10471976</SpeedCursor>
<SpeedPulse>120</SpeedPulse>
<Next>3</Next>
<NextTime>90.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>90</Red>
Expand Down
1 change: 1 addition & 0 deletions hexlevels/1hexagoner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.11423973</SpeedCursor>
<SpeedPulse>120</SpeedPulse>
<Next>4</Next>
<NextTime>90.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>0</Red>
Expand Down
1 change: 1 addition & 0 deletions hexlevels/2hexagonest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.120830484</SpeedCursor>
<SpeedPulse>60</SpeedPulse>
<Next>5</Next>
<NextTime>90.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>49</Red>
Expand Down
1 change: 1 addition & 0 deletions hexlevels/3octogon.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.12566371</SpeedCursor>
<SpeedPulse>80</SpeedPulse>
<Next>5</Next>
<NextTime>90.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>3</Red>
Expand Down
1 change: 1 addition & 0 deletions hexlevels/4hexagoner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.15707964</SpeedCursor>
<SpeedPulse>90</SpeedPulse>
<Next>5</Next>
<NextTime>90.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>102</Red>
Expand Down
1 change: 1 addition & 0 deletions hexlevels/5hexagonest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.17951958</SpeedCursor>
<SpeedPulse>22</SpeedPulse>
<Next>6</Next>
<NextTime>70.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>101</Red>
Expand Down
1 change: 1 addition & 0 deletions hexlevels/6void.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<SpeedCursor>0.17951958</SpeedCursor>
<SpeedPulse>120</SpeedPulse>
<Next>-1</Next>
<NextTime>0.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>0</Red>
Expand Down
38 changes: 38 additions & 0 deletions hexlevels/7credits.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Level>
<Name>CREDITS</Name>
<Difficulty>SPOILERS</Difficulty>
<Mode>(DUH)</Mode>
<Creator>REDHAT</Creator>
<Music>NONE</Music>
<SpeedWall>2.0</SpeedWall>
<SpeedRotation>0.0</SpeedRotation>
<SpeedCursor>0.10471976</SpeedCursor>
<SpeedPulse>120</SpeedPulse>
<Next>-1</Next>
<NextTime>90.0</NextTime>
<BackgroundColorOne>
<Color>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</BackgroundColorOne>
<BackgroundColorTwo>
<Color>
<Red>0</Red>
<Green>0</Green>
<Blue>0</Blue>
</Color>
</BackgroundColorTwo>
<ForegroundColor>
<Color>
<Red>255</Red>
<Green>255</Green>
<Blue>255</Blue>
</Color>
</ForegroundColor>
<LinkedPatterns>
<Pattern>o6_kill.xml</Pattern>
</LinkedPatterns>
</Level>
34 changes: 34 additions & 0 deletions hexlevels/patterns/o6_kill.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Pattern>
<SidesRequired>6</SidesRequired>
<Wall>
<Distance>0</Distance>
<Height>300</Height>
<Side>0</Side>
</Wall>
<Wall>
<Distance>0</Distance>
<Height>300</Height>
<Side>1</Side>
</Wall>
<Wall>
<Distance>0</Distance>
<Height>300</Height>
<Side>2</Side>
</Wall>
<Wall>
<Distance>0</Distance>
<Height>300</Height>
<Side>3</Side>
</Wall>
<Wall>
<Distance>0</Distance>
<Height>300</Height>
<Side>4</Side>
</Wall>
<Wall>
<Distance>0</Distance>
<Height>300</Height>
<Side>5</Side>
</Wall>
</Pattern>
10 changes: 9 additions & 1 deletion src/data/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class Level {

//Files
public static final String XML_HEADER = "Level";
public static final String BIN_HEADER = "LEV2.2";
public static final String BIN_HEADER = "LEV3.0";
public static final String BIN_FOOTER = "ENDLEV";

//Finals
Expand Down Expand Up @@ -70,6 +70,7 @@ public Level(Project project, File levelFile) {
public static final String XML_CREATOR = "Creator";
public static final String XML_MUSIC = "Music";
public static final String XML_NEXT_INDEX = "Next";
public static final String XML_NEXT_TIME = "NextTime";
public static final String XML_BG1 = "BackgroundColorOne";
public static final String XML_BG2 = "BackgroundColorTwo";
public static final String XML_FG = "ForegroundColor";
Expand All @@ -89,6 +90,7 @@ public Level(Project project, File levelFile) {
private float speedCursor;
private int speedPulse;
private int nextIndex;
private float nextTime;
private List<Color> bg1;
private List<Color> bg2;
private List<Color> fg;
Expand All @@ -101,6 +103,7 @@ private void setDefaults() {
this.creator = "ANONYMOUS";
this.music = "NONE";
this.nextIndex = -1;
this.nextTime = 90.0f;
this.speedWall = 2.0f;
this.speedRotation = (float)(Math.PI * 2.0) / 120.0f;
this.speedCursor = (float)(Math.PI * 2.0) / 60.0f;
Expand All @@ -125,6 +128,7 @@ public void readXML(Element e) throws Exception {
this.speedCursor = UtilXML.getFloat(e, XML_SPEED_CURSOR);
this.speedPulse = UtilXML.getInt(e, XML_SPEED_PULSE);
this.nextIndex = UtilXML.getInt(e, XML_NEXT_INDEX);
this.nextTime = UtilXML.getFloat(e, XML_NEXT_TIME);
this.bg1 = UtilXML.getColors(e, XML_BG1);
this.bg2 = UtilXML.getColors(e, XML_BG2);
this.fg = UtilXML.getColors(e, XML_FG);
Expand All @@ -142,6 +146,7 @@ public void writeXML(Element e) {
UtilXML.putFloat(e, XML_SPEED_CURSOR, speedCursor);
UtilXML.putInt(e, XML_SPEED_PULSE, speedPulse);
UtilXML.putInt(e, XML_NEXT_INDEX, nextIndex);
UtilXML.putFloat(e, XML_NEXT_TIME, nextTime);
UtilXML.putColors(e, XML_BG1, bg1);
UtilXML.putColors(e, XML_BG2, bg2);
UtilXML.putColors(e, XML_FG, fg);
Expand All @@ -165,6 +170,7 @@ public void writeBIN(Dynamic d) throws IOException {
d.putFloat(speedCursor);
d.putInt(speedPulse);
d.putInt(nextIndex);
d.putFloat(nextTime);
d.putInt(patterns.size());
for(Pattern p : patterns) d.putString(p.toString());
d.putRawString(BIN_FOOTER);
Expand Down Expand Up @@ -197,6 +203,7 @@ public void windowClosing(WindowEvent e) {
JTextField jCURS = Util.addTitledFieldToPanel(textConfiguration, null, "[TAU/float] Human Step", speedCursor + "");
JTextField jPLUS = Util.addTitledFieldToPanel(textConfiguration, null, "[int] Pulse Speed", speedPulse + "");
JTextField jNEXT = Util.addTitledFieldToPanel(textConfiguration, null, "[int] Next Level Index", nextIndex + "");
JTextField jNTIM = Util.addTitledFieldToPanel(textConfiguration, null, "[float] Next Level Time", nextTime + "");
JButton jSAVE = Util.addButtonToPanel(textConfiguration, null, "Save Configuration");
frame.add(textConfiguration);

Expand Down Expand Up @@ -239,6 +246,7 @@ public void actionPerformed(ActionEvent e) {
speedCursor = Float.parseFloat(jCURS.getText());
speedPulse = Integer.parseInt(jPLUS.getText());
nextIndex = Integer.parseInt(jNEXT.getText());
nextTime = Float.parseFloat(jNTIM.getText());
if(Util.askSave(frame) != JOptionPane.YES_OPTION) return;
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Element el = doc.createElement(XML_HEADER);
Expand Down

0 comments on commit bc26267

Please sign in to comment.