Package com.mygdx.game
Class PirateGame
- java.lang.Object
-
- com.badlogic.gdx.Game
-
- com.mygdx.game.PirateGame
-
- All Implemented Interfaces:
com.badlogic.gdx.ApplicationListener
public class PirateGame extends com.badlogic.gdx.Game
Contains class instances of game UI screens.
-
-
Field Summary
Fields Modifier and Type Field Description GameDifficulty
difficulty
EndScreen
end
GameScreen
game
static int
id_map
MenuScreen
menu
PauseScreen
pause
com.badlogic.gdx.scenes.scene2d.ui.Skin
skin
com.badlogic.gdx.scenes.scene2d.Stage
stage
-
Constructor Summary
Constructors Constructor Description PirateGame()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create()
Create instances of game stage and UI screens.void
dispose()
Clean up prevent memory leeksvoid
LoadGame()
New for assessment 2 Loads the game from the saved datastatic void
loadResources()
Added for Assessment 2 Modularized resource loading, so it can be called from tests and for code clarityvoid
restartGame()
New for assessment 2 Restarts the game by reinitialising the Managers and creating a new instance of GameScreenvoid
setDifficulty(java.lang.String selected)
New for assessment 2 Changes the difficulty for the game by changing the enum and calling GameManager.getSettings()void
setScreen(com.badlogic.gdx.Screen screen)
New for assessment 2 new version of setScreen to stop the game screen being deleted before a new screen is set if the new screen is pause.void
StartGame()
Added for assessment 2 so that the game doesn't start until after the difficulty has been chosen by the player
-
-
-
Field Detail
-
menu
public MenuScreen menu
-
game
public GameScreen game
-
end
public EndScreen end
-
stage
public com.badlogic.gdx.scenes.scene2d.Stage stage
-
skin
public com.badlogic.gdx.scenes.scene2d.ui.Skin skin
-
pause
public PauseScreen pause
-
id_map
public static int id_map
-
difficulty
public GameDifficulty difficulty
-
-
Method Detail
-
create
public void create()
Create instances of game stage and UI screens.
-
loadResources
public static void loadResources()
Added for Assessment 2 Modularized resource loading, so it can be called from tests and for code clarity
-
dispose
public void dispose()
Clean up prevent memory leeks- Specified by:
dispose
in interfacecom.badlogic.gdx.ApplicationListener
- Overrides:
dispose
in classcom.badlogic.gdx.Game
-
setScreen
public void setScreen(com.badlogic.gdx.Screen screen)
New for assessment 2 new version of setScreen to stop the game screen being deleted before a new screen is set if the new screen is pause.- Overrides:
setScreen
in classcom.badlogic.gdx.Game
- Parameters:
screen
- the screen to be changed to
-
restartGame
public void restartGame()
New for assessment 2 Restarts the game by reinitialising the Managers and creating a new instance of GameScreen
-
setDifficulty
public void setDifficulty(java.lang.String selected)
New for assessment 2 Changes the difficulty for the game by changing the enum and calling GameManager.getSettings()
-
StartGame
public void StartGame()
Added for assessment 2 so that the game doesn't start until after the difficulty has been chosen by the player
-
LoadGame
public void LoadGame()
New for assessment 2 Loads the game from the saved data
-
-