Class Camera

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

public class Camera extends Object
Manages the game camera, including following the player, zooming, and shake effects. It handles the camera's position and updates it based on game logic.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Camera instance with default settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.badlogic.gdx.graphics.OrthographicCamera
    Gets the underlying OrthographicCamera instance.
    void
    shake(float shake_duration, float shake_power_degrees)
    Triggers a camera shake effect.
    void
    update(float delta, com.badlogic.gdx.math.Vector2 playerPos, int gameFieldWidth, int gameFieldHeight)
    Updates the camera position to follow the player and handle effects.
    void
    Zooms the camera in by a small factor.
    void
    Zooms the camera out by a small factor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Camera

      public Camera()
      Creates a new Camera instance with default settings.
  • Method Details

    • getCamera

      public com.badlogic.gdx.graphics.OrthographicCamera getCamera()
      Gets the underlying OrthographicCamera instance.
      Returns:
      The LibGDX OrthographicCamera.
    • update

      public void update(float delta, com.badlogic.gdx.math.Vector2 playerPos, int gameFieldWidth, int gameFieldHeight)
      Updates the camera position to follow the player and handle effects.
      Parameters:
      delta - The time elapsed since the last frame.
      playerPos - The current position of the player.
      gameFieldWidth - The width of the game field.
      gameFieldHeight - The height of the game field.
    • zoom_out

      public void zoom_out()
      Zooms the camera out by a small factor.
    • zoom_in

      public void zoom_in()
      Zooms the camera in by a small factor.
    • shake

      public void shake(float shake_duration, float shake_power_degrees)
      Triggers a camera shake effect.
      Parameters:
      shake_duration - The duration of the shake in seconds.
      shake_power_degrees - The intensity of the shake in degrees.