Package de.tum.cit.fop.maze
Class GameScreen
java.lang.Object
de.tum.cit.fop.maze.GameScreen
- All Implemented Interfaces:
com.badlogic.gdx.Screen
The GameScreen class is responsible for rendering the gameplay screen.
It handles the game logic and rendering of the game elements.
-
Constructor Summary
ConstructorsConstructorDescriptionGameScreen(MazeRunnerGame game) Constructor for GameScreen.GameScreen(MazeRunnerGame game, GameScreenMemento memento) Constructor for loading a saved game state. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Gets the achievement UI.Gets the camera.Gets the game controller.Gets the current game field.getHUD()Gets the HUD.Gets the player entity.Gets the sound controller.com.badlogic.gdx.utils.viewport.ViewportGets the viewport.voidhide()booleanisPaused()Checks if the game is paused.voidLoads the next level in story mode.voidpause()voidrender(float delta) voidresize(int width, int height) voidresume()voidsaveGame()Saves the current game state.voidsetGameField(GameField newGameField) Sets a new game field.voidsetPaused(boolean paused) Sets the pause state of the game.voidshow()
-
Constructor Details
-
GameScreen
Constructor for GameScreen. Initializes the game world, UI, and effects.- Parameters:
game- The main game class.
-
GameScreen
Constructor for loading a saved game state.- Parameters:
game- The main game class.memento- The memento containing saved state.
-
-
Method Details
-
render
public void render(float delta) - Specified by:
renderin interfacecom.badlogic.gdx.Screen
-
getGameField
Gets the current game field.- Returns:
- The game field.
-
setGameField
Sets a new game field.- Parameters:
newGameField- The new game field to set.
-
getPlayer
Gets the player entity.- Returns:
- The player.
-
resize
public void resize(int width, int height) - Specified by:
resizein interfacecom.badlogic.gdx.Screen
-
pause
public void pause()- Specified by:
pausein interfacecom.badlogic.gdx.Screen
-
resume
public void resume()- Specified by:
resumein interfacecom.badlogic.gdx.Screen
-
show
public void show()- Specified by:
showin interfacecom.badlogic.gdx.Screen
-
hide
public void hide()- Specified by:
hidein interfacecom.badlogic.gdx.Screen
-
dispose
public void dispose()- Specified by:
disposein interfacecom.badlogic.gdx.Screen
-
isPaused
public boolean isPaused()Checks if the game is paused.- Returns:
- True if paused.
-
setPaused
public void setPaused(boolean paused) Sets the pause state of the game.- Parameters:
paused- True to pause, false to unpause.
-
getSoundController
Gets the sound controller.- Returns:
- The sound controller.
-
getHUD
Gets the HUD.- Returns:
- The HUD.
-
getGameController
Gets the game controller.- Returns:
- The game controller.
-
loadNextStoryLevel
public void loadNextStoryLevel()Loads the next level in story mode. Triggers win screen if all levels are completed. -
getCamera
Gets the camera.- Returns:
- The camera.
-
getViewport
public com.badlogic.gdx.utils.viewport.Viewport getViewport()Gets the viewport.- Returns:
- The viewport.
-
getAchievementUI
Gets the achievement UI.- Returns:
- The achievement UI.
-
saveGame
public void saveGame()Saves the current game state.
-