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
3 changes: 3 additions & 0 deletions src/main/java/event/Event01.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ public Event01(GameManager gm) {
}

public void lookJeramiah() {
// TODO: Add error handling to check if gm or gm.ui is null before using it.
gm.ui.messageText.setText("This is your tall handsome roommate Jeramiah. (He works on cars. Specifically Hondas)");
}
public void talkJeramiah() {
// TODO: Add a try/catch block to handle any potential errors during sound playback.
gm.ui.messageText.setText("Did you hear that noise outside son?");
gm.playSE(gm.engineNoise);
}
Expand Down Expand Up @@ -55,6 +57,7 @@ public void grabFlashlight() {

}
public void restFlashlight() {
// TODO: Display a confirmation dialog before dropping the flashlight.
if(gm.player.hasFlashlight == 1) {
gm.player.hasFlashlight = 0;
gm.ui.messageText.setText("*You rest the flashlight back on the bed*");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/event/Event02.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public Event02(GameManager gm) {
public void search1Honda() {
gm.ui.messageText.setText("Nothing sus here");
}
// TODO: Log the search action for debugging or saving player actions.
public void search2Honda() {
gm.ui.messageText.setText("OH MY GYAT MY ENGINE IS MISSING");
}
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/main/ActionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,38 @@ public ActionHandler(GameManager gm) {
this.gm = gm;
}

/**
* Handles the action event triggered by a button press. This method identifies
* which button was clicked and passes the information to the appropriate game method.
*
* @param e The ActionEvent triggered by the button click.
*/

@Override
public void handle(ActionEvent e) {
String yourChoice = ((javafx.scene.control.Button) e.getSource()).getText();
handleAction(yourChoice);
}

/**
* Executes a specific game action based on the user's choice from the button click.
* This method will change scenes, invoke event logic, or provide feedback based on the action.
*
* @param yourChoice The label text of the clicked button that corresponds to a game action.
*/

// handles the action commands
public void handleAction(String yourChoice) {
switch (yourChoice) {
// TODO: Add more actions as new game features are implemented.
// SCENE 1
case "lookJeramiah":
gm.ev1.lookJeramiah();
break;
case "talkJeramiah":
gm.ev1.talkJeramiah();
break;
// TODO: Document each action method to explain its purpose in the game.
case "restJeramiah":
gm.ev1.restJeramiah();
break;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/main/GameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ public static void main(String[] args) {
launch(args);
}

/**
* Starts the game by setting up the game scene and initializing the timer.
*
* @param primaryStage The primary stage for the JavaFX application.
*/

@Override
public void start(Stage primaryStage) {

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/main/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public void setPlayerDefaultStatus() {

updatePlayerStatus();
}

/**
* Updates the player's status by adjusting the UI elements, such as life icons and item labels,
* based on the player's current attributes.
*/
public void updatePlayerStatus() {

int i = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/main/TimeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void saveTimes() {
oos.writeObject(fastestTimes);
} catch (IOException e) {
System.err.println("Error saving times: " + e.getMessage());
// TODO: Add error recovery mechanism (e.g., alert the user).
}
}

Expand All @@ -70,6 +71,7 @@ void saveLeaderboard() {
}
} catch (IOException e) {
System.err.println("Error saving leaderboard: " + e.getMessage());
// TODO: Add a feature to alert the user if the leaderboard fails to save.
}
}

Expand Down