Package de.tum.cit.fop.maze
Class GameSettings
java.lang.Object
de.tum.cit.fop.maze.GameSettings
Manages game settings and key bindings.
It handles loading and saving settings to a JSON file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintKey binding for using ability.intKey binding for attacking.intKey binding for opening the console.intKey binding for dashing.intKey binding for moving down.intKey binding for interacting.intKey binding for moving left.intMaximum health of the player.intKey binding for opening the progression tree.intScreen resolution height.intScreen resolution width.intKey binding for moving right.intKey binding for moving up.intKey binding for zooming in.intKey binding for zooming out. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GameSettingsCreates default game settings and saves them to the JSON file.intGets the ability key code.intGets the attack key code.intGets the console key code.intGets the dash key code.intGets the down movement key code.intGets the interact key code.intGets the left movement key code.intGets the maximum health setting.intGets the progression tree key code.intGets the resolution height.intGets the resolution width.intGets the right movement key code.intgetUpKey()Gets the up movement key code.intGets the zoom in key code.intGets the zoom out key code.static GameSettingsLoads game settings from the local JSON file.voidsetAbilityKey(int abilityKey) Sets the ability key code.voidsetAttackKey(int attackKey) Sets the attack key code and saves settings.voidsetConsoleKey(int consoleKey) Sets the console key code.voidsetDashKey(int dashKey) Sets the dash key code and saves settings.voidsetDownKey(int downKey) Sets the down movement key code and saves settings.voidsetInteractKey(int interactKey) Sets the interact key code.voidsetLeftKey(int leftKey) Sets the left movement key code and saves settings.voidsetMaxHealth(int maxHealth) Sets the maximum health and saves settings.voidsetProgressionTreeKey(int progressionTreeKey) Sets the progression tree key code.voidsetResolutionHeight(int resolutionHeight) Sets the resolution height.voidsetResolutionWidth(int getResolutionWidth) Sets the resolution width.voidsetRightKey(int rightKey) Sets the right movement key code and saves settings.voidsetUpKey(int upKey) Sets the up movement key code and saves settings.voidsetZoomInKey(int zoomInKey) Sets the zoom in key code and saves settings.voidsetZoomOutKey(int zoomOutKey) Sets the zoom out key code.
-
Field Details
-
maxHealth
public int maxHealthMaximum health of the player. -
upKey
public int upKeyKey binding for moving up. -
leftKey
public int leftKeyKey binding for moving left. -
downKey
public int downKeyKey binding for moving down. -
rightKey
public int rightKeyKey binding for moving right. -
attackKey
public int attackKeyKey binding for attacking. -
dashKey
public int dashKeyKey binding for dashing. -
zoomInKey
public int zoomInKeyKey binding for zooming in. -
zoomOutKey
public int zoomOutKeyKey binding for zooming out. -
interactKey
public int interactKeyKey binding for interacting. -
abilityKey
public int abilityKeyKey binding for using ability. -
consoleKey
public int consoleKeyKey binding for opening the console. -
progressionTreeKey
public int progressionTreeKeyKey binding for opening the progression tree. -
resolutionHeight
public int resolutionHeightScreen resolution height. -
resolutionWidth
public int resolutionWidthScreen resolution width.
-
-
Constructor Details
-
GameSettings
public GameSettings()Creates a new GameSettings instance with default values.
-
-
Method Details
-
loadGameSettings
Loads game settings from the local JSON file. If the file is missing, default settings are created.- Returns:
- The loaded or newly created GameSettings instance.
-
createDefaultSettings
Creates default game settings and saves them to the JSON file.- Returns:
- The newly created GameSettings instance.
-
getMaxHealth
public int getMaxHealth()Gets the maximum health setting.- Returns:
- The max health value.
-
setMaxHealth
public void setMaxHealth(int maxHealth) Sets the maximum health and saves settings.- Parameters:
maxHealth- The new max health value.
-
getUpKey
public int getUpKey()Gets the up movement key code.- Returns:
- The key code for moving up.
-
setUpKey
public void setUpKey(int upKey) Sets the up movement key code and saves settings.- Parameters:
upKey- The new key code.
-
getLeftKey
public int getLeftKey()Gets the left movement key code.- Returns:
- The key code for moving left.
-
setLeftKey
public void setLeftKey(int leftKey) Sets the left movement key code and saves settings.- Parameters:
leftKey- The new key code.
-
getDownKey
public int getDownKey()Gets the down movement key code.- Returns:
- The key code for moving down.
-
setDownKey
public void setDownKey(int downKey) Sets the down movement key code and saves settings.- Parameters:
downKey- The new key code.
-
getRightKey
public int getRightKey()Gets the right movement key code.- Returns:
- The key code for moving right.
-
setRightKey
public void setRightKey(int rightKey) Sets the right movement key code and saves settings.- Parameters:
rightKey- The new key code.
-
getProgressionTreeKey
public int getProgressionTreeKey()Gets the progression tree key code.- Returns:
- The key code for opening the progression tree.
-
setProgressionTreeKey
public void setProgressionTreeKey(int progressionTreeKey) Sets the progression tree key code.- Parameters:
progressionTreeKey- The new key code.
-
getDashKey
public int getDashKey()Gets the dash key code.- Returns:
- The key code for dashing.
-
setDashKey
public void setDashKey(int dashKey) Sets the dash key code and saves settings.- Parameters:
dashKey- The new key code.
-
getAttackKey
public int getAttackKey()Gets the attack key code.- Returns:
- The key code for attacking.
-
setAttackKey
public void setAttackKey(int attackKey) Sets the attack key code and saves settings.- Parameters:
attackKey- The new key code.
-
getZoomInKey
public int getZoomInKey()Gets the zoom in key code.- Returns:
- The key code for zooming in.
-
setZoomInKey
public void setZoomInKey(int zoomInKey) Sets the zoom in key code and saves settings.- Parameters:
zoomInKey- The new key code.
-
getInteractKey
public int getInteractKey()Gets the interact key code.- Returns:
- The key code for interacting.
-
setInteractKey
public void setInteractKey(int interactKey) Sets the interact key code.- Parameters:
interactKey- The new key code.
-
getAbilityKey
public int getAbilityKey()Gets the ability key code.- Returns:
- The key code for using ability.
-
setAbilityKey
public void setAbilityKey(int abilityKey) Sets the ability key code.- Parameters:
abilityKey- The new key code.
-
getConsoleKey
public int getConsoleKey()Gets the console key code.- Returns:
- The key code for opening the console.
-
setConsoleKey
public void setConsoleKey(int consoleKey) Sets the console key code.- Parameters:
consoleKey- The new key code.
-
getResolutionHeight
public int getResolutionHeight()Gets the resolution height.- Returns:
- The resolution height in pixels.
-
setResolutionHeight
public void setResolutionHeight(int resolutionHeight) Sets the resolution height.- Parameters:
resolutionHeight- The new height in pixels.
-
getResolutionWidth
public int getResolutionWidth()Gets the resolution width.- Returns:
- The resolution width in pixels.
-
setResolutionWidth
public void setResolutionWidth(int getResolutionWidth) Sets the resolution width.- Parameters:
getResolutionWidth- The new width in pixels.
-
getZoomOutKey
public int getZoomOutKey()Gets the zoom out key code.- Returns:
- The key code for zooming out.
-
setZoomOutKey
public void setZoomOutKey(int zoomOutKey) Sets the zoom out key code.- Parameters:
zoomOutKey- The new key code.
-