Made it so you can go inbetween screens by pressing enter, allowing for you to speed through the game without pressing buttons.

This commit is contained in:
2019-03-22 23:01:31 -06:00
parent 55ff34ef9b
commit 0bedf3e182
6 changed files with 32 additions and 15 deletions

View File

@@ -192,7 +192,7 @@ public class TravelGUI extends Player{
//Text input for where the player needs to go inside of the game world
numberInput.setAlignment(javafx.geometry.Pos.CENTER_RIGHT);
numberInput.setText("Enter preferred location.");
//numberInput.setText("Enter preferred location.");
numberInput.setOnKeyPressed(event -> {
if(event.getCode().equals(KeyCode.ENTER)||event.getCode().equals(KeyCode.Z)) {
int response;
@@ -232,6 +232,7 @@ public class TravelGUI extends Player{
}
if (hasTraveled) {
continueButton.setVisible(true);
continueButton.setDefaultButton(true);
quitButton.setVisible(false);
numberInput.setVisible(false);
shopScene = true;
@@ -317,6 +318,7 @@ public class TravelGUI extends Player{
hBox0.getChildren().addAll(inventoryText, inventoryHeldText, gunsText, shipStatusText);
numberInput.requestFocus();
flowPane.getChildren().addAll(numberInput, quitButton, continueButton);
gridPane.getColumnConstraints().add(columnConstraints);
@@ -386,6 +388,7 @@ public class TravelGUI extends Player{
int randGenNum = rand.nextInt(3) + 1;
if (randGenNum == 1) {
continueButton.setVisible(true);
continueButton.setDefaultButton(true);
quitButton.setVisible(false);
numberInput.setVisible(false);
textOut.setText(" We see a ship on the horizon " + getName() + "; Prepare for combat!");