Accessed via FlxG.cameras
.
Variables
read onlycameraAdded:FlxTypedSignal<FlxCamera ‑> Void> = new FlxTypedSignal<FlxCamera>()
4.2.0
.read onlycameraRemoved:FlxTypedSignal<FlxCamera ‑> Void> = new FlxTypedSignal<FlxCamera>()
4.2.0
.read onlycameraResized:FlxTypedSignal<FlxCamera ‑> Void> = new FlxTypedSignal<FlxCamera>()
4.2.0
.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.
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
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,
|
Returns:
This FlxCamera instance.
See also:
flixel.FlxBasic.cameras
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. |
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. |
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 |
4.9.0
.See also:
flixel.FlxBasic.cameras
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. |