Accessed via FlxG.cameras.

Variables

bgColor:FlxColor

The current (global, applies to all cameras) bgColor.

@:value(new FlxTypedSignal<FlxCamera>())read onlycameraAdded:FlxTypedSignal<FlxCamera ‑> Void> = new FlxTypedSignal<FlxCamera>()

Available since

4.2.0

.

@:value(new FlxTypedSignal<FlxCamera>())read onlycameraRemoved:FlxTypedSignal<FlxCamera ‑> Void> = new FlxTypedSignal<FlxCamera>()

Available since

4.2.0

.

@:value(new FlxTypedSignal<FlxCamera>())read onlycameraResized:FlxTypedSignal<FlxCamera ‑> Void> = new FlxTypedSignal<FlxCamera>()

Available since

4.2.0

.

@:value([])read onlylist:Array<FlxCamera> = []

An array listing FlxCamera objects that are used to draw stuff. By default flixel creates one camera the size of the screen. Do not edit directly, use add and remove instead.

@:value(false)useBufferLocking:Bool = false

Allows you to possibly slightly optimize the rendering process IF you are not doing any pre-processing in your game state's draw() call.

Methods

@:value({ DefaultDrawTarget : true })add<T>(NewCamera:T, DefaultDrawTarget:Bool = true):T

Add a new camera object to the game. Handy for PiP, split-screen, etc.

Parameters:

NewCamera

The camera you want to add.

DefaultDrawTarget

Whether to add the camera to the list of default draw targets. If false, FlxBasics will not render to it unless you add it to their cameras list.

Returns:

This FlxCamera instance.

See also:

  • flixel.FlxBasic.cameras

@:value({ Force : false, FadeIn : false, Duration : 1, Color : FlxColor.BLACK })fade(Color:FlxColor = FlxColor.BLACK, Duration:Float = 1, FadeIn:Bool = false, ?OnComplete:() ‑> Void, Force:Bool = false):Void

The screen is gradually filled with this color.

Parameters:

Color

The color you want to use.

Duration

How long it takes for the fade to finish.

FadeIn

True fades from a color, false fades to it.

OnComplete

A function you want to run when the fade finishes.

Force

Force the effect to reset.

@:value({ Force : false, Duration : 1, Color : FlxColor.WHITE })flash(Color:FlxColor = FlxColor.WHITE, Duration:Float = 1, ?OnComplete:() ‑> Void, Force:Bool = false):Void

All screens are filled with this color and gradually return to normal.

Parameters:

Color

The color you want to use.

Duration

How long it takes for the flash to fade.

OnComplete

A function you want to run when the flash finishes.

Force

Force the effect to reset.

@:value({ Destroy : true })remove(Camera:FlxCamera, Destroy:Bool = true):Void

Remove a camera from the game.

Parameters:

Camera

The camera you want to remove.

Destroy

Whether to call destroy() on the camera, default value is true.

reset(?NewCamera:FlxCamera):Void

Dumps all the current cameras and resets to just one camera. Handy for doing split-screen especially.

Parameters:

NewCamera

Optional; specify a specific camera object to be the new main camera.

setDefaultDrawTarget(camera:FlxCamera, value:Bool):Void

If set to true, the camera is listed as a default draw target, meaning FlxBasics render to the specified camera if the FlxBasic has a null cameras value.

Parameters:

camera

The camera you wish to change.

value

If false, FlxBasics will not render to it unless you add it to their cameras list.

Available since

4.9.0

.

See also:

  • flixel.FlxBasic.cameras

@:value({ Force : true, Duration : 0.5, Intensity : 0.05 })shake(Intensity:Float = 0.05, Duration:Float = 0.5, ?OnComplete:() ‑> Void, Force:Bool = true, ?Axes:FlxAxes):Void

A simple screen-shake effect.

Parameters:

Intensity

Percentage of screen size representing the maximum distance that the screen can move while shaking.

Duration

The length in seconds that the shaking effect should last.

OnComplete

A function you want to run when the shake effect finishes.

Force

Force the effect to reset (default = true, unlike flash() and fade()!).

Axes

On what axes to shake. Default value is XY / both.