aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/Driver.java7
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/gameplay/SongPlayer.java28
-rwxr-xr-xsrc/main/java/net/sowgro/npehero/gui/LevelSurround.java10
3 files changed, 32 insertions, 13 deletions
diff --git a/src/main/java/net/sowgro/npehero/Driver.java b/src/main/java/net/sowgro/npehero/Driver.java
index 15605cb..d63e447 100755
--- a/src/main/java/net/sowgro/npehero/Driver.java
+++ b/src/main/java/net/sowgro/npehero/Driver.java
@@ -35,7 +35,7 @@ import java.util.Stack;
public class Driver extends Application
{
public static final Image MENU_BACKGROUND = new Image(Driver.class.getResource("mountains.png").toExternalForm());
- public static final File BASE_DIR = new File(getAppDataPath() + "/.npehero");
+ public static File BASE_DIR;
public static Stage primaryStage;
public static ScrollPane primaryPane = new ScrollPane();
@@ -48,6 +48,11 @@ public class Driver extends Application
* starts javafx
*/
public static void main(String[] args) {
+ if (args.length >= 1 && args[0].equals("-localBaseDir")) {
+ BASE_DIR = new File(".npehero");
+ } else {
+ BASE_DIR = new File(getAppDataPath() + "/.npehero");
+ }
launch(args);
}
diff --git a/src/main/java/net/sowgro/npehero/gameplay/SongPlayer.java b/src/main/java/net/sowgro/npehero/gameplay/SongPlayer.java
index 22dea09..fb95eb7 100755
--- a/src/main/java/net/sowgro/npehero/gameplay/SongPlayer.java
+++ b/src/main/java/net/sowgro/npehero/gameplay/SongPlayer.java
@@ -27,15 +27,29 @@ import javafx.util.*;
public class SongPlayer extends HBox {
+ /**
+ * The delay in seconds before anything starts to happen after the user presses play.
+ * after this delay the notes will start to fall, then once one this delay + FALL_TIME has passed the song will start
+ */
+ private final double START_DELAY = 1;
+
+ /**
+ * The time in seconds it will take the notes to fall from 1 noteheight above the top of the screen the target
+ */
+ private final double FALL_TIME = 1.105;
+
+ /**
+ * An extra delay before the notes start to fall after START_DELAY.
+ * This does not affect when the song starts (allowing for syncing to be adjusted)
+ */
+ private final double NOTE_DELAY = 0.2;
+
static class Lane {
Target target; //Initializes the button, each parameter is a placeholder that is changed later
ArrayList<Block> blocks = new ArrayList<>(); //Array list containing all the notes currently on the field for that lane
Pane pane = new Pane();
}
- private final int FALL_TIME = 1; // delay for notes falling down the screen (seconds)
- private final double START_DELAY = 1; // seconds
-
private final Level level;
private final Media song;
private final ScoreController scoreCounter;
@@ -69,17 +83,17 @@ public class SongPlayer extends HBox {
timeline = new Timeline();
for (Note note : notes.list) {
// schedule each note to send at its time
- KeyFrame kf = new KeyFrame(Duration.seconds(note.getTime() + START_DELAY), _ -> sendNote(note));
+ KeyFrame kf = new KeyFrame(Duration.seconds(START_DELAY + NOTE_DELAY + note.getTime()), _ -> sendNote(note));
timeline.getKeyFrames().add(kf);
}
// schedule the song to start after the delay
- timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(FALL_TIME + START_DELAY), _ -> {
+ timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(START_DELAY + FALL_TIME), _ -> {
if (!done) {
Sound.playSong(song);
}
}));
// schedule the game over screen to show at the end
- timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(songLength + FALL_TIME + START_DELAY), _ -> {
+ timeline.getKeyFrames().add(new KeyFrame(Duration.seconds(START_DELAY + FALL_TIME + NOTE_DELAY + songLength), _ -> {
Driver.setMenu(new GameOver(level, diff, prev, scoreCounter));
cancel();
}));
@@ -135,7 +149,7 @@ public class SongPlayer extends HBox {
lane.blocks.add(block);
- TranslateTransition anim = new TranslateTransition(Duration.seconds(FALL_TIME + 0.105));
+ TranslateTransition anim = new TranslateTransition(Duration.seconds(FALL_TIME/* + 0.105*/));
anim.setInterpolator(Interpolator.LINEAR);
anim.byYProperty().bind(lane.pane.heightProperty().add(block.getHeight()).add(75));
anim.setNode(block);
diff --git a/src/main/java/net/sowgro/npehero/gui/LevelSurround.java b/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
index f4d46a3..e6cc2f4 100755
--- a/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
+++ b/src/main/java/net/sowgro/npehero/gui/LevelSurround.java
@@ -105,11 +105,11 @@ public class LevelSurround extends Page
AnchorPane.setBottomAnchor(comboTextBox, 0.0);
comboBox.setPadding(new Insets(10));
- game.setMinHeight(1080);
- game.setMinWidth(1080 * 0.55);
- game.setMaxHeight(1080);
- game.setMaxWidth(1080 * 0.55);
- var scale = content.prefHeightProperty().divide(1080);
+ game.setMinHeight(720);
+ game.setMinWidth(720 * 0.55);
+ game.setMaxHeight(720);
+ game.setMaxWidth(720 * 0.55);
+ var scale = content.prefHeightProperty().divide(720);
game.scaleXProperty().bind(scale);
game.scaleYProperty().bind(scale);
game.getStyleClass().add("box");