Initialize Camera object.
The Rect parameters only require width and height properties.
The TileSprite or Sprite for the camera to follow.
Size of the camera's view into the game.
Size of the game world. Uses viewport by default.
The opacity of the entity (from 0 to 1)
An array of child entities for recursive update/render.
Whether or not the entity is dead.
Amount to move towards subject per update.
Range from 0 to 1 where 0 is not moving, and 1 is always on subject. Default is .3
Position of the entity.
Scale of the entity.
Whether or not the entity is visible.
Whether or not there are any child entities.
Add and return a child object.
Object to add to the container.
Add a brief overlay to 'flash' the viewport.
Time in seconds for flash to fade out.
Color of the overlay used.
Focus the camera on the subject.
Range from 0 to 1 where 0 is not moving, and 1 is on subject.
Whether or not to keep the subject in tracking limits.
Remove and return a child object.
Object to remove from the container.
Set debug status on camera.
When true, a rectangle displays on-screen showing camera tracking bounds.
Only call after everything is added to the camera.
Whether to turn debugging on or off.
Update the subject being tracked by the camera.
Also causes the camera to refocus to the new subject.
The new subject to track.
Update tracking offsets used to keep the subject in view.
Offset of tracking space from sides on X axis.
Offset of tracking space from sides on Y axis.
Shake the camera randomly for a short time.
Number of pixels to shake the camera.
Time in seconds to shake.
Update the camera.
Delta time since last update.
Timestamp in seconds.
Follows a subject to provide a viewport into a game world.
Example
Assumes this is in a Scene.
const camera = new Camera(player, { width: 640, height: 480 } as Rect, { width: map.mapWidth * map.tileWidth, height: map.mapHeight * map.tileHeight } as Rect) this.camera = this.add<Camera>(camera)