Packageorg.flixel
Classpublic class FlxCamera
InheritanceFlxCamera Inheritance FlxBasic Inheritance Object



Public Properties
 PropertyDefined By
 Inheritedactive : Boolean
Controls whether update() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_ACTIVECOUNT : uint
[static]
FlxBasic
 Inheritedalive : Boolean
Useful state for many game objects - "dead" (!alive) vs alive.
FlxBasic
  alpha : Number
FlxCamera
  angle : Number
FlxCamera
  antialiasing : Boolean
FlxCamera
  bgColor : uint
The natural background color of the camera.
FlxCamera
  bounds : FlxRect
The edges of the camera's range, i.e.
FlxCamera
  buffer : BitmapData
The actual bitmap data of the camera display itself.
FlxCamera
  color : uint
FlxCamera
  deadzone : FlxRect
You can assign a "dead zone" to the camera in order to better control its movement.
FlxCamera
  defaultZoom : Number
[static]
FlxCamera
 Inheritedexists : Boolean
Controls whether update() and draw() are automatically called by FlxState/FlxGroup.
FlxBasic
  _flashBitmap : Bitmap
Internal, used to render buffer to screen space.
FlxCamera
  height : uint
FlxCamera
 InheritedID : int
IDs seem like they could be pretty useful, huh?
FlxBasic
  scroll : FlxPoint
Stores the basic parallax scrolling values.
FlxCamera
  target : FlxObject
Tells the camera to follow this FlxObject object around.
FlxCamera
 Inheritedvisible : Boolean
Controls whether draw() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_VISIBLECOUNT : uint
[static]
FlxBasic
  width : uint
FlxCamera
  x : Number
FlxCamera
  y : Number
FlxCamera
  zoom : Number
FlxCamera
Protected Properties
 PropertyDefined By
  _color : uint
Internal, help with color transforming the flash bitmap.
FlxCamera
  _fill : BitmapData
FlxCamera
  _flashPoint : Point
FlxCamera
  _flashRect : Rectangle
FlxCamera
  _fxFadeAlpha : Number
FlxCamera
  _fxFadeColor : uint
FlxCamera
  _fxFadeComplete : Function
FlxCamera
  _fxFadeDuration : Number
FlxCamera
  _fxFlashAlpha : Number
FlxCamera
  _fxFlashColor : uint
FlxCamera
  _fxFlashComplete : Function
FlxCamera
  _fxFlashDuration : Number
FlxCamera
  _fxShakeComplete : Function
FlxCamera
  _fxShakeDirection : uint
FlxCamera
  _fxShakeDuration : Number
FlxCamera
  _fxShakeIntensity : Number
FlxCamera
  _fxShakeOffset : FlxPoint
FlxCamera
  _point : FlxPoint
Internal, to help avoid costly allocations.
FlxCamera
  _zoom : Number
Indicates how far the camera is zoomed in.
FlxCamera
Public Methods
 MethodDefined By
  
FlxCamera(X:int, Y:int, Width:int, Height:int, Zoom:Number = 0)
FlxCamera
  
FlxCamera
  
destroy():void
[override]
FlxCamera
 Inherited
draw():void
Override this function to control how the object is drawn.
FlxBasic
  
drawFX():void
FlxCamera
  
fade(Color:uint = 0xffffffff, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void
The screen is gradually filled with this color.
FlxCamera
  
fill(Color:uint = 0, BlendAlpha:Boolean = true):void
FlxCamera
  
flash(Color:uint = 0xffffffff, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void
The screen is filled with this color and gradually returns to normal.
FlxCamera
  
focusOn(Point:FlxPoint):void
Move the camera focus to this location instantly.
FlxCamera
  
follow(Target:FlxObject, Style:uint):void
Tells this camera object what FlxObject to track.
FlxCamera
  
FlxCamera
 Inherited
kill():void
FlxBasic
 Inherited
onScreen(Camera:FlxCamera = null):Boolean
FlxBasic
 Inherited
postUpdate():void
FlxBasic
 Inherited
preUpdate():void
FlxBasic
 Inherited
revive():void
FlxBasic
  
setBounds(X:Number = 0, Y:Number = 0, Width:Number = 0, Height:Number = 0, UpdateWorld:Boolean = false):void
Specify the boundaries of the level or where the camera is allowed to move.
FlxCamera
  
setScale(X:Number, Y:Number):void
FlxCamera
  
shake(Intensity:Number = 0.05, Duration:Number = 0.5, OnComplete:Function = null, Force:Boolean = true, Direction:uint):void
A simple screen-shake effect.
FlxCamera
  
stopFX():void
FlxCamera
 Inherited
toString():String
Convert object to readable string name.
FlxBasic
  
update():void
[override]
FlxCamera
Public Constants
 ConstantDefined By
  SHAKE_BOTH_AXES : uint = 0
[static]
FlxCamera
  SHAKE_HORIZONTAL_ONLY : uint = 2
[static]
FlxCamera
  SHAKE_VERTICAL_ONLY : uint = 1
[static]
FlxCamera
  STYLE_LOCKON : uint = 0
[static]
FlxCamera
  STYLE_PLATFORMER : uint = 1
[static]
FlxCamera
  STYLE_TOPDOWN : uint = 2
[static]
FlxCamera
  STYLE_TOPDOWN_TIGHT : uint = 3
[static]
FlxCamera
Property Detail
_colorproperty
protected var _color:uint

Internal, help with color transforming the flash bitmap.

_fillproperty 
protected var _fill:BitmapData

_flashBitmapproperty 
public var _flashBitmap:Bitmap

Internal, used to render buffer to screen space.

_flashPointproperty 
protected var _flashPoint:Point

_flashRectproperty 
protected var _flashRect:Rectangle

_fxFadeAlphaproperty 
protected var _fxFadeAlpha:Number

_fxFadeColorproperty 
protected var _fxFadeColor:uint

_fxFadeCompleteproperty 
protected var _fxFadeComplete:Function

_fxFadeDurationproperty 
protected var _fxFadeDuration:Number

_fxFlashAlphaproperty 
protected var _fxFlashAlpha:Number

_fxFlashColorproperty 
protected var _fxFlashColor:uint

_fxFlashCompleteproperty 
protected var _fxFlashComplete:Function

_fxFlashDurationproperty 
protected var _fxFlashDuration:Number

_fxShakeCompleteproperty 
protected var _fxShakeComplete:Function

_fxShakeDirectionproperty 
protected var _fxShakeDirection:uint

_fxShakeDurationproperty 
protected var _fxShakeDuration:Number

_fxShakeIntensityproperty 
protected var _fxShakeIntensity:Number

_fxShakeOffsetproperty 
protected var _fxShakeOffset:FlxPoint

_pointproperty 
protected var _point:FlxPoint

Internal, to help avoid costly allocations.

_zoomproperty 
protected var _zoom:Number

Indicates how far the camera is zoomed in.

alphaproperty 
alpha:Number


Implementation
    public function get alpha():Number
    public function set alpha(value:Number):void
angleproperty 
angle:Number


Implementation
    public function get angle():Number
    public function set angle(value:Number):void
antialiasingproperty 
antialiasing:Boolean


Implementation
    public function get antialiasing():Boolean
    public function set antialiasing(value:Boolean):void
bgColorproperty 
public var bgColor:uint

The natural background color of the camera. Defaults to FlxG.bgColor. NOTE: can be transparent for crazy FX!

boundsproperty 
public var bounds:FlxRect

The edges of the camera's range, i.e. where to stop scrolling.

bufferproperty 
public var buffer:BitmapData

The actual bitmap data of the camera display itself.

colorproperty 
color:uint


Implementation
    public function get color():uint
    public function set color(value:uint):void
deadzoneproperty 
public var deadzone:FlxRect

You can assign a "dead zone" to the camera in order to better control its movement. The camera will always keep the player inside the dead zone.

defaultZoomproperty 
public static var defaultZoom:Number

heightproperty 
public var height:uint

scrollproperty 
public var scroll:FlxPoint

Stores the basic parallax scrolling values.

targetproperty 
public var target:FlxObject

Tells the camera to follow this FlxObject object around.

widthproperty 
public var width:uint

xproperty 
public var x:Number

yproperty 
public var y:Number

zoomproperty 
zoom:Number


Implementation
    public function get zoom():Number
    public function set zoom(value:Number):void
Constructor Detail
FlxCamera()Constructor
public function FlxCamera(X:int, Y:int, Width:int, Height:int, Zoom:Number = 0)



Parameters
X:int
 
Y:int
 
Width:int
 
Height:int
 
Zoom:Number (default = 0)
Method Detail
copyFrom()method
public function copyFrom(Camera:FlxCamera):FlxCamera

Parameters

Camera:FlxCamera

Returns
FlxCamera
destroy()method 
override public function destroy():void

drawFX()method 
public function drawFX():void

fade()method 
public function fade(Color:uint = 0xffffffff, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void

The screen is gradually filled with this color.

Parameters

Color:uint (default = 0xffffffff) — The color you want to use.
 
Duration:Number (default = 1) — How long it takes for the fade to finish.
 
OnComplete:Function (default = null) — A function you want to run when the fade finishes.
 
Force:Boolean (default = false) — Force the effect to reset.

fill()method 
public function fill(Color:uint = 0, BlendAlpha:Boolean = true):void

Parameters

Color:uint (default = 0)
 
BlendAlpha:Boolean (default = true)

flash()method 
public function flash(Color:uint = 0xffffffff, Duration:Number = 1, OnComplete:Function = null, Force:Boolean = false):void

The screen is filled with this color and gradually returns to normal.

Parameters

Color:uint (default = 0xffffffff) — The color you want to use.
 
Duration:Number (default = 1) — How long it takes for the flash to fade.
 
OnComplete:Function (default = null) — A function you want to run when the flash finishes.
 
Force:Boolean (default = false) — Force the effect to reset.

focusOn()method 
public function focusOn(Point:FlxPoint):void

Move the camera focus to this location instantly.

Parameters

Point:FlxPoint — Where you want the camera to focus.

follow()method 
public function follow(Target:FlxObject, Style:uint):void

Tells this camera object what FlxObject to track.

Parameters

Target:FlxObject — The object you want the camera to track. Set to null to not follow anything.
 
Style:uint (default = NaN) — How fast to track it (default: 1 - slowish).

getScale()method 
public function getScale():FlxPoint

Returns
FlxPoint
setBounds()method 
public function setBounds(X:Number = 0, Y:Number = 0, Width:Number = 0, Height:Number = 0, UpdateWorld:Boolean = false):void

Specify the boundaries of the level or where the camera is allowed to move.

Parameters

X:Number (default = 0) — The smallest X value of your level (usually 0).
 
Y:Number (default = 0) — The smallest Y value of your level (usually 0).
 
Width:Number (default = 0) — The largest X value of your level (usually the level width).
 
Height:Number (default = 0) — The largest Y value of your level (usually the level height).
 
UpdateWorld:Boolean (default = false) — Whether the global quad-tree's dimensions should be updated to match (default: false).

setScale()method 
public function setScale(X:Number, Y:Number):void

Parameters

X:Number
 
Y:Number

shake()method 
public function shake(Intensity:Number = 0.05, Duration:Number = 0.5, OnComplete:Function = null, Force:Boolean = true, Direction:uint):void

A simple screen-shake effect.

Parameters

Intensity:Number (default = 0.05) — Percentage of screen size representing the maximum distance that the screen can move while shaking.
 
Duration:Number (default = 0.5) — The length in seconds that the shaking effect should last.
 
OnComplete:Function (default = null) — A function you want to run when the shake effect finishes.
 
Force:Boolean (default = true) — Force the effect to reset (default = true, unlike flash() and fade()!).
 
Direction:uint (default = NaN) — Whether to shake on both axes, just up and down, or just side to side (use class constants SHAKE_BOTH_AXES, SHAKE_VERTICAL_ONLY, or SHAKE_HORIZONTAL_ONLY).

stopFX()method 
public function stopFX():void

update()method 
override public function update():void

Constant Detail
SHAKE_BOTH_AXESConstant
public static const SHAKE_BOTH_AXES:uint = 0

SHAKE_HORIZONTAL_ONLYConstant 
public static const SHAKE_HORIZONTAL_ONLY:uint = 2

SHAKE_VERTICAL_ONLYConstant 
public static const SHAKE_VERTICAL_ONLY:uint = 1

STYLE_LOCKONConstant 
public static const STYLE_LOCKON:uint = 0

STYLE_PLATFORMERConstant 
public static const STYLE_PLATFORMER:uint = 1

STYLE_TOPDOWNConstant 
public static const STYLE_TOPDOWN:uint = 2

STYLE_TOPDOWN_TIGHTConstant 
public static const STYLE_TOPDOWN_TIGHT:uint = 3