ridder
Version:
A straightforward game engine for simple data-driven games in JavaScript
49 lines (48 loc) • 1.68 kB
TypeScript
import { Rectangle } from "./rectangle.js";
import { Vector } from "./vector.js";
/**
* Updates the camera's `position` to the given target position ({@link x}, {@link y}). Does so smoothly if `smoothing` is smaller than 1.
*
* Updates the camera's `shake` vector, reducing the shaking `shakeIntensity` gradually with `shakeReduction`.
*
* All while taking into the camera's `zoom` factor into account.
*/
export declare function updateCamera(x: number, y: number): void;
/**
* Snap the camera to the given position.
*/
export declare function setCameraPosition(x: number, y: number): void;
/**
* Returns the camera's current position.
*
* NOTE - This is the top-left corner, not the center of the camera.
*/
export declare function getCameraPosition(): Readonly<Vector>;
/**
* Set the camera's smoothing value.
*/
export declare function setCameraSmoothing(value: number): void;
/**
* The rectangular area which to bind the camera's movement within.
*/
export declare function setCameraBounds(x: number, y: number, width: number, height: number): void;
/**
* Get the camera's movement boundary.
*/
export declare function getCameraBounds(): Readonly<Rectangle>;
/**
* Set the current camera shake intensity and the value by which the intensity will be reduced every frame.
*/
export declare function setCameraShake(intensity: number, reduction: number): void;
/**
* Get the camera's shake vector.
*/
export declare function getCameraShake(): Readonly<Vector>;
/**
* Set the camera's zoom value.
*/
export declare function setCameraZoom(value: number): void;
/**
* Get the camera's current zoom value.
*/
export declare function getCameraZoom(): number;