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.GameContains class instances of game UI screens.
-
-
Field Summary
Fields Modifier and Type Field Description GameDifficultydifficultyEndScreenendGameScreengamestatic intid_mapMenuScreenmenuPauseScreenpausecom.badlogic.gdx.scenes.scene2d.ui.Skinskincom.badlogic.gdx.scenes.scene2d.Stagestage
-
Constructor Summary
Constructors Constructor Description PirateGame()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate()Create instances of game stage and UI screens.voiddispose()Clean up prevent memory leeksvoidLoadGame()New for assessment 2 Loads the game from the saved datastatic voidloadResources()Added for Assessment 2 Modularized resource loading, so it can be called from tests and for code clarityvoidrestartGame()New for assessment 2 Restarts the game by reinitialising the Managers and creating a new instance of GameScreenvoidsetDifficulty(java.lang.String selected)New for assessment 2 Changes the difficulty for the game by changing the enum and calling GameManager.getSettings()voidsetScreen(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.voidStartGame()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:
disposein interfacecom.badlogic.gdx.ApplicationListener- Overrides:
disposein 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:
setScreenin 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
-
-