Classes

Main

Responsibilities:

  • Initializes and configures the LibGDX game environment.
  • Creates global resources such as SpriteBatch, BitmapFont, FitViewport, and Skin.
  • Sets the initial screen to MainMenuScreen.
  • Manages screen transitions between all stages of the game (MainMenuScreen, CharacterSelectScreen, GameScreen, etc.).
  • Handles global rendering cycle and resource cleanup when the application ends.

Collaborators:

  • MainMenuScreen, CharacterSelectScreen, GameScreen, WinScreen, GameOverScreen, PauseScreen - controlled through screen transitions.
  • Skin, SpriteBatch, Fonts - shared resources accessed by all screens.

MainMenuScreen

Responsibilities:

  • Displays the main menu interface with options such as Play and Exit.
  • Loads and renders the background image and game title text.
  • Handles button creation, layout, and user input using Stage and Skin.
  • Initiates the character selection screen when Play is selected or closes the application when Exit is clicked.

Collaborators:

  • Main - provides access to shared assets (batch, menuFont, buttonSkin) and handles screen transitions.
  • CharacterSelectScreen - launched when the player selects “Play.”
  • LibGDX Stage - used for UI rendering and input event management.

CharacterSelectScreen

Responsibilities:

  • Displays the character selection interface where the player chooses between male and female characters.
  • Loads and renders background and character images from the asset folders.
  • Uses Stage, Skin, and ImageButton to create interactive UI elements.
  • Updates the selected character path and transitions to GameScreen when a character is chosen.
  • Provides a Back button to return to the MainMenuScreen.

Collaborators:

  • Main - supplies shared resources (batch, viewport, menuFont, buttonSkin) and handles screen transitions.
  • GameScreen - receives the selected sprite path and starts gameplay with that character.
  • MainMenuScreen - opened when the “Back” button is clicked.

GameScreen

Responsibilities:

  • Runs main gameplay loop.
  • Handles entity behavior, collisions, and interactions.
  • Updates lighting and animation each frame.

Collaborators:

  • Player - receives input and updates position.
  • Lighting - controls visual illumination.
  • Goose - manages enemy AI.
  • PauseScreen, WinScreen, GameOverScreen - for game state transitions.

Player

Responsibilities:

  • Controls player movement, animation, and collision.
  • Handles input for walking and direction changes.
  • Updates torch position and rotation based on player state.

Collaborators:

  • Main - provides viewport for boundaries.
  • GameScreen - updates player each frame.
  • SpriteAnimations - provides animation frames.

Goose

Responsibilities:

  • Defines enemy behavior and pathfinding logic.
  • Detects collision with player and triggers game-over state.
  • Updates sprite movement and animations.

Collaborators:

  • GameScreen - manages updates and rendering.
  • Player - detects collisions and interactions.

Lighting

Responsibilities:

  • Generates lighting and shadow effects on map and characters.
  • Updates illumination levels dynamically.
  • Enhances visual depth and realism in gameplay scenes.

Collaborators:

  • GameScreen - calls lighting updates per frame.
  • Player - lighting reacts to the player's position.

PauseScreen

Responsibilities:

  • Displays pause UI, allowing players to resume or back to the main menu.
  • Suspends updates for all entities during pause state.

Collaborators:

  • GameScreen - paused and resumed through this screen.
  • MainMenuScreen - opened when the “Main Menu” button is clicked.
  • Main - manages transitions between screens.

WinScreen

Responsibilities:

  • Displays the victory screen when the player meets win conditions.
  • Renders congratulatory text and player score using the game’s shared menuFont.
  • Waits for user input (touch/click) to return to the main menu.
  • Uses Stage and ExtendViewport for consistent layout across screen sizes.

Collaborators:

  • Main - manages screen switching and resource sharing (viewport, batch, fonts).
  • MainMenuScreen - opened when the user clicks to return to the main menu.

GameOverScreen

Responsibilities:

  • Displays the Game Over screen when the player loses.
  • Shows a custom death message describing how the player failed.
  • Uses menuFont for rendering text and Stage with ExtendViewport for scalable layout.
  • Waits for user input (click) to return to the main menu.

Collaborators:

  • Main - provides viewport, batch, and handles screen switching.
  • MainMenuScreen - opened when the user clicks after the Game Over screen is displayed.

AudioManager

Responsibilities:

  • Loads sound effects and music assets from specified files.
  • Plays, loops, pauses, and stops sound effects and music.
  • Adjusts the volume of music and sound effects.
  • Disposes of audio resources when no longer needed.

Collaborators:

  • Main - provides gameVolume and musicVolume settings for controlling sound levels.
  • GameScreen - requests sound effects based on game events.

BuildingManager

Responsibilities:

  • Manages building related interactions and triggers.
  • Detects when the player is near buildings and displays enter prompts.
  • Allows entering/exiting buildings based on user input.
  • Updates the building interaction state.
  • Renders building-related visuals and UI prompts.

Collaborators:

  • Main - manages screen transitions.
  • GameScreen - controls the game state and switches between building and world views.
  • Player - tracks player position and triggers interactions with buildings.
  • AudioManager - plays sound effects.

Collectable

Responsibilities:

  • Represents collectable items in the game.
  • Tracks item position, visibility, and state (collected or not).
  • Detects if the player is in range to collect the item.
  • Marks the item as collected and updates its size for the inventory bar.
  • Plays a sound effect when collected.

Collaborators:

  • AudioManager - plays collection sound.
  • Player - interacts with collectable items (checks range and collects them).

InstructionsScreen

Responsibilities:

  • Displays the instructions screen before the game starts.
  • Displays the game’s title and a brief introduction.
  • Creates and positions UI elements.
  • Handles user input to transition to the next screen.
  • Manages input processors for UI interaction.

Collaborators:

  • Main - provides assets and controls screen transitions.
  • GameScreen - switches to the game screen when Play is clicked.
  • CharacterSelectScreen - navigated to when the Space key is pressed.
  • Stage, Skin - used to render and handle UI elements like buttons.

LangwithScreen

Responsibilities:

  • Displays the interior of the Langwith building.
  • Manages player movement, interactions, and item collection.
  • Handles UI rendering for inventory, events tracker, and game timer.
  • Pauses gameplay when the Pause key is pressed and transitions to the Pause screen.
  • Updates game events and displays relevant information on-screen.
  • Allows the player to interact with collectable items.

Collaborators:

  • Main - provides game assets and manages screen transitions.
  • GameScreen - provides game state and updates player speed.
  • BuildingManager - manages building-related logic.
  • Player - tracks player movement and handles interactions with collectable items.
  • Collectable - defines and updates collectable items within the game world.

RonCookeScreen

Responsibilities:

  • Displays the interior of the Ron Cooke building.
  • Manages player movement, interactions, and item collection (key card, torch).
  • Handles speech events and displays messages from the receptionist.
  • Updates game state, including timer and events tracker.
  • Pauses gameplay when the Pause key is pressed and transitions to the Pause screen.
  • Renders UI elements, such as collected items, score, and time.

Collaborators:

  • Main - provides game assets and manages screen transitions.
  • BuildingManager - handles building-related logic and updates.
  • GameScreen - tracks game state and updates player speed.
  • Player - controls player movement and interactions with items.
  • Collectable - defines and updates collectable items within the game world.

SpriteAnimations

Responsibilities:

  • Loads and splits sprite sheets into individual frames for animations.
  • Stores animations in a dictionary based on configuration information.
  • Provides methods to generate animations from sprite sheets.
  • Manages map layer information for boundary detection.
  • Disposes of the sprite sheet when no longer needed.

Collaborators:

  • TiledMapTileLayer - used to detect map boundaries for animation positioning.
  • TextureRegion - used for managing sprite sheet regions.
  • Animation - used for creating the animations from sprite frames.
  • GameScreen - may interact with animations for character movement or actions.

Initial CRC Cards - Not Used in Project

These are the initial CRC cards created during early planning, which were not used in the final project.

Main/EscapeFromUni

Responsibilities:

  • Initializes and configures the LibGDX game environment.
  • Manages global resources.
  • Handles main game loop.
  • Manages asset/resource rendering.

Collaborators:

  • StateManager - Game transitions.
  • AssetManager - Resource rendering/deposing.
  • All screen classes - Screen rendering.

StateManager

Responsibilities:

  • Track/manage current game state.
  • Handles state transitions.
  • Update variables for state changes.
  • Possibly maintain state history for back button (unlikely due to small number of states).

Collaborators:

  • EscapeFromUni - called to change state.
  • EventManager - Event change notification for state changes.
  • All Screen classes - state-orientated screen changes.

AssetManager

Responsibilities:

  • Loads/caches game assets (textures, sprites, maps, sounds, etc.).
  • Manages memory usage and unloading assets.

Collaborators:

  • EscapeFromUni - initialization/removal coordination of assets and more.
  • All screen classes - provides the assets for rendering.
  • GameScreen - Provides the player sprites, enemy sprites, map, and UI assets.

InputHandler

Responsibilities:

  • Centralized input processing for movement and other inputs.
  • Switching input definitions based on screen.

Collaborators:

  • StateManager - For screen-based input switching.
  • GameScreen - Provides gameplay specific inputs.
  • Player - Sends/inherits the movement inputs.
  • Menu Screens - Menu navigation inputs/buttons.

EventManager

Responsibilities:

  • Manages, tracks and enacts events.
  • Handles event orders and conditions.
  • Coordinates with other classes for communication of state, screen, etc.

Collaborators:

  • All game classes - for event requests and event updates.
  • StateManager - states that rely on events or vice versa for verification.
  • GameScreen - gameplay related events (e.g. item pickup, damage/collision).

GameScreen

Responsibilities:

  • Main game loop for rendering and updating.
  • Coordinates any entity interactions/updates.
  • Handles collision detection.
  • Manages the game world’s state.

Collaborators:

  • StateManager - for pausing/game ending screens.
  • InputHandler - receives player inputs.
  • EventManager - enact gameplay events.
  • HUD - provides information for the state of HUD.
  • AssetManager - retrieves game screen relevant assets.

MainMenuScreen

Responsibilities:

  • Display main menu UI and navigation options.
  • Renders menu background (if there is one) and title/text fonts.
  • Handles button interactions.
  • Gives access to settings/character selection.

Collaborators:

  • StateManager - menu state management.
  • InputHandler - menu inputs for navigation.
  • AssetManager - menu assets (mostly fonts).
  • CharacterSelectScreen - screen transition with button in menu.

CharacterSelectScreen

Responsibilities:

  • Display character selection UI.
  • Transition to gameplay (GameScreen) with selected character.
  • Displays preview of character options.

Collaborators:

  • MainMenuScreen - return/back inputs.
  • GameScreen - character selection input.
  • AssetManager - character sprites and UI assets/fonts.
  • InputHandler - handles input processing for navigation.

HUD

Responsibilities:

  • Renders/loads game overlay.
  • Displays possibly sprite information or timers.
  • Provides small tutorials/explanations and events.

Collaborators:

  • GameScreen - receives updates and changes based on game updates.
  • EventManager - changes based on UI relevant events.
  • AssetManager - HUD assets.
  • Player - player information if relevant to HUD.