Legacy follow modes – kept for backward compatibility.
Internally mapped to FollowStrategy instances.
FIXED: Any = 'fixed'
FOLLOW: Any = 'follow'
PLATFORMER: Any = 'platformer'
TOPDOWN: Any = 'topdown'
No methods defined.
Type of camera shake effect.
POSITIONAL: Any = 'positional'
ROTATIONAL: Any = 'rotational'
TRAUMA: Any = 'trauma'
No methods defined.
Easing functions for smooth camera movement.
LINEAR: Any = 'linear'
SMOOTHSTEP: Any = 'smoothstep'
QUADRATIC_IN: Any = 'quadratic_in'
QUADRATIC_OUT: Any = 'quadratic_out'
QUADRATIC_IN_OUT: Any = 'quadratic_in_out'
CUBIC_IN: Any = 'cubic_in'
CUBIC_OUT: Any = 'cubic_out'
CUBIC_IN_OUT: Any = 'cubic_in_out'
No methods defined.
Abstract base class for camera follow behaviours.
def get_target_position(self: Any, camera: 'Camera', dt: float) -> pygame.Vector2
Follow the target's world position directly.
def get_target_position(self: Any, camera: 'Camera', dt: float) -> pygame.Vector2
Keep the camera at a fixed world position, ignoring the target.
def __init__(self: Any, fixed_position: Union[Tuple[float, float], pygame.Vector2]) -> Any
def get_target_position(self: Any, camera: 'Camera', dt: float) -> pygame.Vector2
Platformer-style camera with a deadzone in screen space.
The camera moves only when the target leaves the deadzone rectangle.
def __init__(self: Any, deadzone_rect: Optional[pygame.Rect] = None) -> Any
def get_target_position(self: Any, camera: 'Camera', dt: float) -> pygame.Vector2
Top-down RPG style camera with look‑ahead based on target velocity/direction.
def __init__(self: Any, lead_factor: float = 0.3) -> Any
def get_target_position(self: Any, camera: 'Camera', dt: float) -> pygame.Vector2
Limits applied to camera movement and zoom.
min_zoom: float = 0.1
max_zoom: float = 10.0
bounds: Optional[pygame.Rect] = None
rotation_range: Tuple[float, float] = (-180.0, 180.0)
No methods defined.
Base class for temporary camera effects (shake, fade, flash, etc.).
def update(self: Any, dt: float) -> bool
def apply(self: Any, camera: 'Camera') -> None
Positional or rotational shake with intensity decay.
def __init__(self: Any, intensity: float = 1.0, duration: float = 0.5, shake_type: CameraShakeType = CameraShakeType.POSITIONAL) -> Any
def update(self: Any, dt: float) -> bool
def apply(self: Any, camera: 'Camera') -> None
Trauma‑based shake – intensity scales with trauma^2.
def __init__(self: Any, trauma: float = 1.0, decay_rate: float = 1.5) -> Any
def update(self: Any, dt: float) -> bool
def apply(self: Any, camera: 'Camera') -> None
A single sprite inside a parallax layer.
Attributes:
surface: The image to draw.
base_pos: World position relative to the layer's origin (in world units).
scale: Uniform scale factor (1.0 = original size).
color: RGB colour multiplier (1.0,1.0,1.0 = normal).
alpha: Opacity (0.0 = transparent, 1.0 = opaque).
angle: Rotation in degrees (0 = no rotation).
oscillate_x: Sine wave amplitude for X movement (world units).
oscillate_y: Sine wave amplitude for Y movement.
oscillate_speed: Oscillation frequency (cycles per second).
phase_offset: Initial phase offset (radians) – randomise for variety.
brightness_pulse: Amplitude of brightness pulsation (0..1).
brightness_speed: Pulsation speed (cycles per second).
surface: pygame.Surface = None
base_pos: pygame.Vector2 = field(default_factory=lambda: pygame.Vector2(0, 0))
_cache: Dict[str, Tuple[float, float, Tuple[int, int, int]]] = field(default_factory=dict, init=False, repr=False)
scale: float = 1.0
color: Tuple[float, float, float] = (1.0, 1.0, 1.0)
alpha: float = 1.0
angle: float = 0.0
oscillate_x: float = 0.0
oscillate_y: float = 0.0
oscillate_speed: float = 1.0
phase_offset: float = 0.0
brightness_pulse: float = 0.0
brightness_speed: float = 1.0
wind_movement: bool = True
wind_intensity: float = 0.0
def __post_init__(self: Any) -> Any
def get_animated_offset(self: Any, time: float) -> pygame.Vector2
def get_current_brightness(self: Any, time: float) -> float
def get_transformed_surface(self: Any, size: Tuple[int, int], angle: float, colour: Tuple[float, float, float, float]) -> pygame.Surface
A scrollable layer that can contain:
- A single tiled texture (simple & efficient)
- A list of individual ParallaxSprites (flexible)
If `tile_texture` is set, the layer ignores the sprite list and renders tiled.
Otherwise, it renders the sprite list.
def __init__(self: Any, speed: Tuple[float, float] = (1.0, 1.0), repeat_x: bool = True, repeat_y: bool = True, z_index: int = 0) -> Any
def set_tiled_texture(self: Any, texture: pygame.Surface) -> Any
def add_sprite(self: Any, sprite: ParallaxSprite) -> Any
def add_sprites(self: Any, sprites: List[ParallaxSprite]) -> Any
def clear_sprites(self: Any) -> Any
def populate_random(self: Any, surface: pygame.Surface, count: int, area: pygame.Rect, scale_range: Tuple[float, float] = (1.0, 1.0), speed_range: Tuple[float, float] = (0.0, 0.0), oscillate_x_range: Tuple[float, float] = (0.0, 0.0), oscillate_y_range: Tuple[float, float] = (0.0, 0.0), oscillate_speed_range: Tuple[float, float] = (0.5, 2.0), brightness_pulse_range: Tuple[float, float] = (0.0, 0.0), brightness_speed_range: Tuple[float, float] = (0.5, 2.0), alpha_range: Tuple[float, float] = (1.0, 1.0), angle_range: Tuple[float, float] = (0.0, 0.0), seed: Optional[int] = None) -> Any
Manager for multiple parallax layers.
Provides global time for animations and brightness pulsations.
def __init__(self: Any, camera: 'Camera') -> Any
def add_layer(self: Any, speed: Tuple[float, float] = (1.0, 1.0), repeat_x: bool = True, repeat_y: bool = True, z_index: int = 0) -> ParallaxLayer
def remove_layer(self: Any, layer: ParallaxLayer) -> Any
def clear(self: Any) -> Any
def update(self: Any, dt: float) -> Any
def render(self: Any, renderer: OpenGLRenderer, viewport: Optional[pygame.Rect] = None) -> Any
def _render_tiled(self: Any, renderer: OpenGLRenderer, layer: ParallaxLayer, viewport: pygame.Rect) -> Any
def _render_sprites(self: Any, renderer: OpenGLRenderer, layer: ParallaxLayer, viewport: pygame.Rect) -> Any
Advanced 2D Camera with unified coordinate system (position = viewport center).
Supports multiple follow strategies, constraints, effects, and parallax.
def __init__(self: Any, scene: 'Scene', width: int, height: int) -> Any
def position(self: Any) -> pygame.Vector2
def position(self: Any, value: Any) -> Any
def base_position(self: Any) -> pygame.Vector2
def mode(self: Any) -> CameraMode
def mode(self: Any, value: CameraMode) -> Any
def viewport_rect(self: Any) -> pygame.Rect
def set_target(self: Any, target: Any, mode: Optional[CameraMode] = None) -> Any
def set_follow_strategy(self: Any, strategy: FollowStrategy) -> Any
def set_bounds(self: Any, bounds: pygame.Rect) -> Any
def set_zoom(self: Any, zoom: float, smooth: bool = True) -> Any
def shake(self: Any, intensity: float = 1.0, duration: float = 0.5, shake_type: CameraShakeType = CameraShakeType.POSITIONAL) -> Any
def add_trauma(self: Any, amount: float) -> Any
def add_effect(self: Any, effect: CameraEffect) -> Any
def remove_effect(self: Any, effect: CameraEffect) -> Any
def clear_effects(self: Any) -> Any
def update(self: Any, dt: float) -> Any
def _apply_smooth_movement(self: Any, dt: float) -> Any
def _apply_smooth_zoom(self: Any, dt: float) -> Any
def _update_effects(self: Any, dt: float) -> Any
def _apply_constraints(self: Any) -> Any
def _update_viewport_rect(self: Any) -> Any
def _update_renderer_camera_position(self: Any) -> Any
def world_to_screen(self: Any, world_pos: Union[Tuple[float, float], pygame.Vector2, List[float], np.ndarray]) -> pygame.Vector2
def world_to_screen_list(self: Any, world_positions: List, return_type: str = 'list') -> Any
def screen_to_world(self: Any, screen_pos: Union[Tuple[float, float], pygame.Vector2, List[float], np.ndarray]) -> pygame.Vector2
def screen_to_world_list(self: Any, screen_positions: List) -> List[pygame.Vector2]
def screen_to_world_vector(self: Any, screen_vec: Union[Tuple[float, float], pygame.Vector2]) -> pygame.Vector2
def convert_size_zoom(self: Any, size: Union[Tuple[float, float], List[float], float, pygame.Vector2]) -> Any
def convert_size_zoom_list(self: Any, sizes: List, return_type: str = 'list') -> Any
def get_visible_rect(self: Any) -> pygame.Rect
def is_visible(self: Any, world_pos: Union[Tuple[float, float], pygame.Vector2], margin: float = 0.0) -> bool
def get_transform_matrix(self: Any) -> Any
def get_view_projection_matrix(self: Any, width: Optional[int] = None, height: Optional[int] = None, column_major: bool = False) -> np.ndarray
def _get_target_position(self: Any) -> pygame.Vector2
def add_parallax_layer(self: Any, surface: pygame.Surface, speed_factor: float, tile_mode: bool = True, offset: Tuple[float, float] = (0, 0)) -> ParallaxLayer
def remove_parallax_layer(self: Any, layer: ParallaxLayer) -> Any
def clear_parallax_layers(self: Any) -> Any
def render_parallax(self: Any, renderer: Any) -> None
def enable_parallax(self: Any, enabled: bool = True) -> Any
def get_parallax_layer_count(self: Any) -> int
def _interpolate_linear(start: float, end: float, t: float) -> float
No documentation
def _interpolate_smoothstep(start: float, end: float, t: float) -> float
No documentation
def _interpolate_quadratic_in(start: float, end: float, t: float) -> float
No documentation
def _interpolate_quadratic_out(start: float, end: float, t: float) -> float
No documentation
def _interpolate_quadratic_in_out(start: float, end: float, t: float) -> float
No documentation
def _interpolate_cubic_in(start: float, end: float, t: float) -> float
No documentation
def _interpolate_cubic_out(start: float, end: float, t: float) -> float
No documentation
def _interpolate_cubic_in_out(start: float, end: float, t: float) -> float
No documentation
def interpolate(start: Union[float, pygame.Vector2], end: Union[float, pygame.Vector2], t: float, itype: InterpolationType = InterpolationType.LINEAR) -> Union[float, pygame.Vector2]
Interpolate between start and end using the specified easing function.