Package de.tum.cit.fop.maze
Class Camera
java.lang.Object
de.tum.cit.fop.maze.Camera
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 -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.graphics.OrthographicCameraGets the underlying OrthographicCamera instance.voidshake(float shake_duration, float shake_power_degrees) Triggers a camera shake effect.voidupdate(float delta, com.badlogic.gdx.math.Vector2 playerPos, int gameFieldWidth, int gameFieldHeight) Updates the camera position to follow the player and handle effects.voidzoom_in()Zooms the camera in by a small factor.voidzoom_out()Zooms the camera out by a small factor.
-
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.
-