Class DeathScreen

java.lang.Object
com.badlogic.gdx.ScreenAdapter
com.csse3200.game.screens.DeathScreen
All Implemented Interfaces:
com.badlogic.gdx.Screen

public class DeathScreen extends com.badlogic.gdx.ScreenAdapter
Screen shown when the player is defeated.

This class extends BaseScreen and provides the specific UI entity for the death scenario. The UI includes:

  • A "Defeated" title
  • Round and elapsed time labels
  • Buttons for retrying the game or returning to the main menu

Common lifecycle management (service registration, renderer setup, asset loading/unloading, and background creation) is handled by BaseScreen.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final GdxGame
    Game instance for navigation and context.
    protected final Renderer
    Renderer responsible for drawing.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new DeathScreen instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Entity
    createUIScreen(com.badlogic.gdx.scenes.scene2d.Stage stage)
    Provides the UI entity for the death screen.
    void
     
    void
    render(float delta)
     
    void
    resize(int width, int height)
     
    void
    updateTime(long second)
     

    Methods inherited from class com.badlogic.gdx.ScreenAdapter

    hide, pause, resume, show

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • game

      protected final GdxGame game
      Game instance for navigation and context.
    • renderer

      protected final Renderer renderer
      Renderer responsible for drawing.
  • Constructor Details

    • DeathScreen

      public DeathScreen(GdxGame game)
      Constructs a new DeathScreen instance.

      This will:

      Parameters:
      game - the GdxGame instance, used for screen navigation
  • Method Details

    • createUIScreen

      protected Entity createUIScreen(com.badlogic.gdx.scenes.scene2d.Stage stage)
      Provides the UI entity for the death screen.

      This entity includes:

      Parameters:
      stage - stage for UI
      Returns:
      the UI Entity for the death screen
    • updateTime

      public void updateTime(long second)
    • render

      public void render(float delta)
      Specified by:
      render in interface com.badlogic.gdx.Screen
      Overrides:
      render in class com.badlogic.gdx.ScreenAdapter
    • resize

      public void resize(int width, int height)
      Specified by:
      resize in interface com.badlogic.gdx.Screen
      Overrides:
      resize in class com.badlogic.gdx.ScreenAdapter
    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.Screen
      Overrides:
      dispose in class com.badlogic.gdx.ScreenAdapter