Class GameApp
java.lang.Object
javafx.application.Application
game.GameApp
public class GameApp
extends javafx.application.Application
Main game application class for JavaFX Bullet Hell.
Handles the game loop, rendering, input, and player/room management.
-
Nested Class Summary
Nested classes/interfaces inherited from class javafx.application.Application
javafx.application.Application.Parameters -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag to track if the game is overprivate booleanFlag to ensure game-over sound effect only plays onceprivate booleanFlag to track if the game has startedstatic final doubleGame canvas heightprivate javafx.scene.text.FontFont used for HUD and screensprivate PlayerReference to the player objectprivate RoomManagerRoom manager singletonstatic final doubleGame canvas widthFields inherited from class javafx.application.Application
STYLESHEET_CASPIAN, STYLESHEET_MODENA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voiddrawDeadScreen(javafx.scene.canvas.GraphicsContext gc) Draws the death/game-over screen with score and restart instructions.private voiddrawHUD(javafx.scene.canvas.GraphicsContext gc) Draws the heads-up display (HUD) including HP bar and coin counter.private voiddrawStartScreen(javafx.scene.canvas.GraphicsContext gc) Draws the start screen with instructions.static voidApplication entry point.private voidResets game state and player/room manager for a new game.voidstart(javafx.stage.Stage stage) Initializes and starts the JavaFX application.Methods inherited from class javafx.application.Application
getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stop
-
Field Details
-
gameStarted
private boolean gameStartedFlag to track if the game has started -
gameOver
private boolean gameOverFlag to track if the game is over -
gameOverSFXPlayed
private boolean gameOverSFXPlayedFlag to ensure game-over sound effect only plays once -
player
Reference to the player object -
WIDTH
public static final double WIDTHGame canvas width- See Also:
-
HEIGHT
public static final double HEIGHTGame canvas height- See Also:
-
roomManager
Room manager singleton -
pixelFont
private javafx.scene.text.Font pixelFontFont used for HUD and screens
-
-
Constructor Details
-
GameApp
public GameApp()
-
-
Method Details
-
main
Application entry point.- Parameters:
args- Command-line arguments
-
getPlayer
- Returns:
- The player instance
-
start
public void start(javafx.stage.Stage stage) Initializes and starts the JavaFX application.- Specified by:
startin classjavafx.application.Application- Parameters:
stage- The primary stage provided by JavaFX
-
restartGame
private void restartGame()Resets game state and player/room manager for a new game. -
drawStartScreen
private void drawStartScreen(javafx.scene.canvas.GraphicsContext gc) Draws the start screen with instructions.- Parameters:
gc- GraphicsContext for drawing
-
drawDeadScreen
private void drawDeadScreen(javafx.scene.canvas.GraphicsContext gc) Draws the death/game-over screen with score and restart instructions.- Parameters:
gc- GraphicsContext for drawing
-
drawHUD
private void drawHUD(javafx.scene.canvas.GraphicsContext gc) Draws the heads-up display (HUD) including HP bar and coin counter.- Parameters:
gc- GraphicsContext for drawing
-