Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/edu/sdccd/cisc190/altscenes/five1Morning.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import javafx.scene.text.Text;
import javafx.stage.Stage;

//TODO: Capitalize all classes under altscenes and scenes packages

public class five1Morning {
private Scene scene;
private int conviction; // Variable to track the conviction stat
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/edu/sdccd/cisc190/generalstuff/MainGame.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ public class MainGame extends Application {
public void start(Stage primaryStage) {
// Create scenes for each part of the game
TitleScreen titleScreen = new TitleScreen(primaryStage);

//TODO: MainMenu and Prelude aren't being used so delete them
MainMenu mainMenu = new MainMenu(primaryStage);
PreLude gameScreen = new PreLude(primaryStage);

Expand Down
62 changes: 39 additions & 23 deletions src/main/java/edu/sdccd/cisc190/generalstuff/MainMenu.java
Original file line number Diff line number Diff line change
@@ -1,56 +1,68 @@
package edu.sdccd.cisc190.generalstuff;

import edu.sdccd.cisc190.stats.GameState;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;

public class MainMenu {
private final Scene scene;

//TODO: Delete these because they wont be needed due to the instantiation below
private int conviction; // stat for conviction
private int madness; // stat for madness

public MainMenu(Stage primaryStage) {
conviction = 0; // Initial conviction
madness = 0; // Initial madness
//TODO: Make the gameState object accessible across all scenes to maintain a total of these running stats
GameState gameState = new GameState(0,0);

// Create the buttons and description text
Button startButton = new Button("Unlock the door (+1 conviction, +1 madness)");
Button exitButton = new Button("Don't Unlock the door");

Text description = new Text("You’re the new guy working in Seven Guys, a local burger shop that on the outside, is a fun and exciting place to eat at, " +
"filled with yummy food and a huge-ass party stage with cool party rooms, and of course, " +
"the main attraction: The High Fives. But behind closed doors, a different story appears.\n" +
"Debts haven't been paid, the kitchen has violated a bunch of health codes and laws, " +
"and signs of the animatronics… moving on their own, like they’re being controlled by spirits. " +
"Maybe they’re linked to the disappearing workers lately… " +
"But hey! with the new Security Computer Auto Machine (or S.C.A.M for short), " +
"they’re able to make sure everything is A-Ok!\nStanding in front of the Burger-plex. " +
"You realize you were never given a key to the place. " +
"“Lazy managers” you murmured as a note was plastered onto the back entrance.\n" +
"“Yeah we totally forgot to give you the key, it'll be under the rock!”\n" +
"Groaning you grab the key from under the rock and prepare to open the door. " +
"Suddenly, the unexplainable urge to do nothing was filling your mind. " +
"“Is this a tutorial?” (Pick the options presented to make your choice, choose wisely, well in this case you only have one but, you know, don’t fall too deep~)\n");
description.setStyle("-fx-font-size: 9px; -fx-font-weight: bold;");
/**
* TODO: These texts should be broken down into smaller pieces so it looks better and is easier to read. Do this for all your wordy texts.
* Description text split into smaller, logical sections
*/
Text description1 = new Text("You’re the new guy working in Seven Guys, a local burger shop that, on the outside, is a fun and exciting place to eat at, filled with yummy food, a huge party stage with cool party rooms, and of course, the main attraction: The High Fives.\n\n");
Text description2 = new Text("But behind closed doors, a different story appears. Debts haven't been paid, the kitchen has violated health codes, and signs of animatronics moving on their own suggest they’re being controlled by spirits. Maybe they’re linked to the disappearing workers lately…\n\n");
Text description3 = new Text("With the new 'Security Computer Auto Machine' (or S.C.A.M. for short), they’re able to make sure everything is A-Ok! Standing in front of the Burger-plex, you realize you were never given a key to the place. 'Lazy managers,' you murmur as a note plastered on the back entrance reads:\n\n");
Text description4 = new Text("'Yeah, we totally forgot to give you the key, it'll be under the rock!'\n\n");
Text description5 = new Text("Groaning, you grab the key and prepare to open the door. Suddenly, the unexplainable urge to do nothing fills your mind. 'Is this a tutorial?' (Pick the options presented to make your choice. Choose wisely—well, in this case, you only have one option, but you know, don’t fall too deep~)\n");

// Combine all parts into a TextFlow for proper wrapping
TextFlow description = new TextFlow(description1, description2, description3, description4, description5);
description.setTextAlignment(TextAlignment.JUSTIFY);
description.setMaxWidth(680); // Ensure the text wraps within the scene width
description.setStyle("-fx-font-size: 11px; -fx-font-weight: bold;");

// Action for unlocking the door: Increase conviction and madness, then transition to PreLude scene
startButton.setOnAction(e -> {
conviction += 1; // Increase conviction
madness += 1; // Increase madness

// Pass conviction and madness to PreLude when transitioning
PreLude preludeScene = new PreLude(primaryStage, conviction, madness);
//Not necessary to manually add to conviction and madness. Use the methods increaseConviction and increase madness from GameState class.
gameState.increaseConviction();
gameState.increaseMadness();

/**
* Pass conviction and madness to PreLude when transitioning
* Call getConviction and getMadness from GameState Class whenever the return value is needed
*/

PreLude preludeScene = new PreLude(primaryStage, gameState.getConviction(), gameState.getMadness());
primaryStage.setScene(preludeScene.getScene());
});

// Action to exit the application
exitButton.setOnAction(e -> primaryStage.close());

// Create a text element to display stats
Text stats = new Text("Conviction: " + conviction + " | Madness: " + madness);
Text stats = new Text("Conviction: " + gameState.getConviction() + " | Madness: " + gameState.getMadness());
stats.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");

// Create the BorderPane layout
Expand All @@ -63,14 +75,18 @@ public MainMenu(Stage primaryStage) {
VBox buttonLayout = new VBox(10, startButton, exitButton);
layout.setCenter(buttonLayout);

//Center Text, Do for ALL scenes
BorderPane.setAlignment(description, Pos.TOP_CENTER);

// Set stats at the bottom of the layout
layout.setBottom(stats);

// Align buttons to center within the bottom region
BorderPane.setAlignment(buttonLayout, javafx.geometry.Pos.CENTER);

// Create the scene with the BorderPane layout
scene = new Scene(layout, 300, 400);
//Change width to 700 for better readability and user experience
scene = new Scene(layout, 700, 350);
}

// Getter for the scene
Expand Down
11 changes: 9 additions & 2 deletions src/main/java/edu/sdccd/cisc190/generalstuff/PreLude.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package edu.sdccd.cisc190.generalstuff;

import edu.sdccd.cisc190.scenes.twelveMorning;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
Expand All @@ -14,6 +15,7 @@ public class PreLude {
// Constructor to accept conviction and madness
public PreLude(Stage primaryStage, int conviction, int madness) {
// Create the game status text
//TODO: Break up text
Text gameStatus = new Text("What was that? Did the stat points that should be appearing on a “screen” increase. " +
"Apparently, everything you do is judge. Of Judgey devs. Huh what did we do-.\n" +
"“Whatever, I can do this” you say anxiously of the sanity meter that is also there.\n" +
Expand All @@ -23,7 +25,9 @@ public PreLude(Stage primaryStage, int conviction, int madness) {
"There’s the door to the main stage on your left, a table filled with monitors of the different cameras around the restaurant, " +
"a fan on top that barely works, and of course, a flashlight and a badge on your moldy chair " +
"that you’re sure hasn’t been cleaned in weeks… you have a bad feeling about this. How… cliche.\n");
gameStatus.setStyle("-fx-font-size: 9px; -fx-font-weight: bold;");
gameStatus.setStyle("-fx-font-size: 11px; -fx-font-weight: bold;");

gameStatus.setWrappingWidth(680);

// Create the display for stats (Conviction and Madness)
Text statsText = new Text("Conviction: " + conviction + " | Madness: " + madness);
Expand All @@ -47,8 +51,11 @@ public PreLude(Stage primaryStage, int conviction, int madness) {
VBox buttonLayout = new VBox(10, actionButton);
layout.setCenter(buttonLayout);

//Center the text so that it isn't directly touching the edge of the window
BorderPane.setAlignment(gameStatus, Pos.TOP_CENTER);

// Create the scene with the layout and set the preferred size
scene = new Scene(layout, 300, 400);
scene = new Scene(layout, 700, 400);
}

public PreLude(Stage primaryStage) {
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/edu/sdccd/cisc190/generalstuff/TitleScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Text;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;

public class TitleScreen {
Expand All @@ -15,10 +17,18 @@ public TitleScreen(Stage primaryStage) {
"Isn't entirely perfect, but... it works!!!");
titleText.setStyle("-fx-font-size: 30px; -fx-font-weight: bold;");

// Wrap the title text using TextFlow so the text doesn't run off-screen.
TextFlow titleTextFlow = new TextFlow(titleText);
titleTextFlow.setTextAlignment(TextAlignment.CENTER);
titleTextFlow.setMaxWidth(380); // Set max width to wrap text within scene width

// Create the start button
Button startButton = new Button("Prelude to Insanity");
startButton.setStyle("-fx-font-size: 20px;");

// Center the button explicitly
BorderPane.setAlignment(startButton, javafx.geometry.Pos.CENTER);

// Create the MainMenu instance, but do not create the scene yet
MainMenu mainMenu = new MainMenu(primaryStage);

Expand All @@ -28,8 +38,9 @@ public TitleScreen(Stage primaryStage) {
// Set up the BorderPane layout
BorderPane layout = new BorderPane();

// Add the titleText to the top of the BorderPane
layout.setTop(titleText);
// Add the wrapped titleTextFlow to the top of the BorderPane
layout.setTop(titleTextFlow);
BorderPane.setAlignment(titleTextFlow, javafx.geometry.Pos.CENTER);

// Add the startButton to the center of the BorderPane
layout.setCenter(startButton);
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/edu/sdccd/cisc190/scenes/MorningScenes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package edu.sdccd.cisc190.scenes;

/**
* This is an abstract class for general things you want the other morning scenes to inherit
* This will make your numbered morning child classes cleaner
*/

public abstract class MorningScenes {
//TODO: Create instance fields and variables for your scenes

//TODO: Add an updateStats() method here and a method to display text

}
28 changes: 15 additions & 13 deletions src/main/java/edu/sdccd/cisc190/scenes/fiveMorning.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import edu.sdccd.cisc190.altscenes.five1Morning;
import edu.sdccd.cisc190.generalstuff.ExitGame;
import edu.sdccd.cisc190.generalstuff.MainMenu;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
Expand All @@ -11,11 +10,10 @@
import javafx.stage.Stage;

public class fiveMorning {

private Scene scene;
private int conviction; // Variable to track the conviction stat
private int madness; // Variable to track the madness stat
private final Text gameStatus;
private final Text statsText; // Text to display the stats
private Text statsText; // Text to display the stats

public fiveMorning(Stage primaryStage) {
// Initial game status text
Expand All @@ -32,10 +30,14 @@ public fiveMorning(Stage primaryStage) {
"You hear noises… loud noises…");
gameStatus.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");

// Text for displaying stats (conviction and madness)
statsText = new Text("Conviction: " + conviction + " | Madness: " + madness);
statsText.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");
// Button actions
BorderPane layout = getBorderPane(primaryStage);

// Scene 700x400
scene = new Scene(layout, 700, 400);
}

//contain
private BorderPane getBorderPane(Stage primaryStage) {
Button oneButton = new Button("Investigate");
oneButton.setStyle("-fx-font-size: 14px;");
oneButton.setOnAction(e -> gameStatus.setText("Going towards the loud noise, you find that Daniel the Dog fell hard from Backstage.\n" +
Expand Down Expand Up @@ -64,13 +66,13 @@ public fiveMorning(Stage primaryStage) {
// Set the VBox containing buttons to the center of the BorderPane
layout.setCenter(buttonBox);

// Scene creation with appropriate size
scene = new Scene(layout, 400, 400);
return layout;
}

// Method to update the stats text
private void updateStats() {
statsText.setText("Conviction: " + conviction + " | Madness: " + madness);
// TODO: Use this method whenever you want to display user's conviction and madness stats. Uncomment the first line.
public void updateStats() {
//statsText.setText("Conviction: " + gameState.getConviction() + " | Madness: " + gameState.getMadness());
statsText.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");
}

// Getter for the scene
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/edu/sdccd/cisc190/scenes/fourMorning.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@

public class fourMorning {
private Scene scene;
private int conviction; // Variable to track the conviction stat
private int madness; // Variable to track the madness stat
private final Text gameStatus;
private final Text statsText; // Text to display the stats
//private final Text statsText; // Text to display the stats

// Declare buttons as instance variables to use them in different methods
private final Button oneButton;
Expand Down Expand Up @@ -40,10 +38,10 @@ public fourMorning(Stage primaryStage) {
gameStatus.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");

// Text for displaying stats (conviction and madness)
statsText = new Text("Conviction: " + conviction + " | Madness: " + madness);
statsText.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");
//statsText = new Text("Conviction: " + gameState.getConviction() + " | Madness: " + gameState.getMadness());
//statsText.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");

// Initialize buttons
//TODO: Store these buttons in an array and loop through them
oneButton = new Button("Kitchen time");
twoButton = new Button("Investigate");
threeButton = new Button("Bottle of water");
Expand All @@ -55,7 +53,7 @@ public fourMorning(Stage primaryStage) {
nineButton = new Button("Go Back");
continueButton = new Button("Transition to 5 AM");

// Set styles for the buttons
//TODO: Create a loop that sets the style of each button
oneButton.setStyle("-fx-font-size: 14px;");
twoButton.setStyle("-fx-font-size: 14px;");
threeButton.setStyle("-fx-font-size: 14px;");
Expand All @@ -67,7 +65,7 @@ public fourMorning(Stage primaryStage) {
nineButton.setStyle("-fx-font-size: 14px;");
continueButton.setStyle("-fx-font-size: 14px;");

// Set the continue button to be initially invisible
//TODO: Create loop to set the visibility
threeButton.setVisible(false);
fourButton.setVisible(false);
fiveButton.setVisible(false);
Expand All @@ -77,7 +75,7 @@ public fourMorning(Stage primaryStage) {
nineButton.setVisible(false);
continueButton.setVisible(false);

// Button actions
// Use case statement for cleaner readability
oneButton.setOnAction(e -> {
gameStatus.setText("Deciding that the noise is just some random object that is DEFINITELY not part of the noise from the restroom earlier, a need to go to the kitchen seems like the most reasonable choice for you and your break.\n" +
"\n" +
Expand Down Expand Up @@ -219,7 +217,7 @@ public fourMorning(Stage primaryStage) {
layout.setTop(gameStatus);

// Add stats text below the game status text
layout.setBottom(statsText);
//layout.setBottom(statsText);

// Create a VBox to arrange buttons vertically
VBox buttonBox = new VBox(10); // 10px spacing between buttons
Expand All @@ -233,16 +231,18 @@ public fourMorning(Stage primaryStage) {
}

// Method to update the stats text
//TODO: Delete this because its been created in FiveMorning class
private void updateStats() {
statsText.setText("Conviction: " + conviction + " | Madness: " + madness);
//statsText.setText("Conviction: " + gameState.getConviction + " | Madness: " + gameState.getMadness);
}

// Helper method to hide the action buttons
// TODO: Rename vague methods so that anyone that reads it can infer exactly what it does. You can rename this to hideButtons12
private void hideOtherButtons() {
oneButton.setVisible(false);
twoButton.setVisible(false);
}

//TODO: Rename to hideButtons34589
private void hideMoreButtons() {
threeButton.setVisible(false);
fourButton.setVisible(false);
Expand Down
Loading