Class GameSettings

java.lang.Object
de.tum.cit.fop.maze.GameSettings

public class GameSettings extends Object
Manages game settings and key bindings. It handles loading and saving settings to a JSON file.
  • Field Details

    • maxHealth

      public int maxHealth
      Maximum health of the player.
    • upKey

      public int upKey
      Key binding for moving up.
    • leftKey

      public int leftKey
      Key binding for moving left.
    • downKey

      public int downKey
      Key binding for moving down.
    • rightKey

      public int rightKey
      Key binding for moving right.
    • attackKey

      public int attackKey
      Key binding for attacking.
    • dashKey

      public int dashKey
      Key binding for dashing.
    • zoomInKey

      public int zoomInKey
      Key binding for zooming in.
    • zoomOutKey

      public int zoomOutKey
      Key binding for zooming out.
    • interactKey

      public int interactKey
      Key binding for interacting.
    • abilityKey

      public int abilityKey
      Key binding for using ability.
    • consoleKey

      public int consoleKey
      Key binding for opening the console.
    • progressionTreeKey

      public int progressionTreeKey
      Key binding for opening the progression tree.
    • resolutionHeight

      public int resolutionHeight
      Screen resolution height.
    • resolutionWidth

      public int resolutionWidth
      Screen resolution width.
  • Constructor Details

    • GameSettings

      public GameSettings()
      Creates a new GameSettings instance with default values.
  • Method Details

    • loadGameSettings

      public static GameSettings 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

      public static GameSettings 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.