Packageorg.flixel
Classpublic class FlxCore
SubclassesFlxBlock, FlxButton, FlxEmitter, FlxLayer, FlxPanel, FlxSound, FlxSprite, FlxTilemap

This is the base class for most of the display objects (FlxSprite, FlxText, etc). It includes some basic attributes about game objects, including retro-style flickering, basic state information, sizes, and scrolling. This class also contains the basic collision methods used by every flixel object.



Public Properties
 PropertyDefined by
  active : Boolean
If an object is not alive, the game loop will not automatically call update() on it.
FlxCore
  dead : Boolean
If an object is dead, the functions that automate collisions will skip it (see FlxG.overlapArrays() and FlxG.collideArrays()).
FlxCore
  exists : Boolean
Kind of a global on/off switch for any objects descended from FlxCore.
FlxCore
  fixed : Boolean
If an object is 'fixed' in space, it will not budge when it collides with a not-fixed object.
FlxCore
  height : uint
FlxCore
  last : Point
Stores the last position of the sprite, used by collision detection algorithm.
FlxCore
  scrollFactor : Point
A point that can store numbers from 0 to 1 (for X and Y independently) that governs how much this object is affected by the camera subsystem.
FlxCore
  visible : Boolean
If an object is not visible, the game loop will not automatically call render() on it.
FlxCore
  width : uint
FlxCore
  x : Number
FlxCore
  y : Number
FlxCore
Protected Properties
 PropertyDefined by
  _flicker : Boolean
Internal helper used for retro-style flickering.
FlxCore
  _flickerTimer : Number
Internal helper used for retro-style flickering.
FlxCore
Public Methods
 MethodDefined by
  
Creates a new FlxCore object.
FlxCore
  
collide(Core:FlxCore):Boolean
Collides a FlxCore against this object.
FlxCore
  
collideArray(Cores:Array):void
Collides an array of FlxCore objects against the tilemap.
FlxCore
  
collideArrayX(Cores:Array):void
Collides an array of FlxCore objects against the tilemap against the X axis only.
FlxCore
  
collideArrayY(Cores:Array):void
Collides an array of FlxCore objects against the tilemap against the Y axis only.
FlxCore
  
collideX(Core:FlxCore):Boolean
Collides a FlxCore against this object on the X axis ONLY.
FlxCore
  
collideY(Core:FlxCore):Boolean
Collides a FlxCore against this object on the Y axis ONLY.
FlxCore
  
destroy():void
Called by FlxLayer when states are changed (if it belongs to a layer)
FlxCore
  
flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style.
FlxCore
  
flickering():Boolean
Check to see if the object is still flickering.
FlxCore
  
getScreenXY(P:Point = null):Point
Call this function to figure out the on-screen position of the object.
FlxCore
  
hitCeiling(Contact:FlxCore = null):Boolean
Called when this object collides with the bottom of another FlxCore.
FlxCore
  
hitFloor(Contact:FlxCore = null):Boolean
Called when this object collides with the top of another FlxCore.
FlxCore
  
hitWall(Contact:FlxCore = null):Boolean
Called when this object collides with another FlxCore on one of its sides.
FlxCore
  
kill():void
Call this function to "kill" a sprite so that it no longer 'exists'.
FlxCore
  
onScreen():Boolean
Check and see if this object is currently on screen.
FlxCore
  
overlaps(Core:FlxCore):Boolean
Checks to see if some FlxCore object overlaps this FlxCore object.
FlxCore
  
overlapsPoint(X:Number, Y:Number, PerPixel:Boolean = false):Boolean
Checks to see if a point in 2D space overlaps this FlxCore object.
FlxCore
  
render():void
FlxSprite and other subclasses override this to draw their contents to the screen.
FlxCore
  
reset(X:Number, Y:Number):void
Handy function for reviving game objects.
FlxCore
  
update():void
Just updates the flickering.
FlxCore
Property detail
activeproperty
public var active:Boolean

If an object is not alive, the game loop will not automatically call update() on it.

deadproperty 
public var dead:Boolean

If an object is dead, the functions that automate collisions will skip it (see FlxG.overlapArrays() and FlxG.collideArrays()).

existsproperty 
public var exists:Boolean

Kind of a global on/off switch for any objects descended from FlxCore.

fixedproperty 
public var fixed:Boolean

If an object is 'fixed' in space, it will not budge when it collides with a not-fixed object.

_flickerproperty 
protected var _flicker:Boolean

Internal helper used for retro-style flickering.

_flickerTimerproperty 
protected var _flickerTimer:Number

Internal helper used for retro-style flickering.

heightproperty 
public var height:uint

The default value is 0.

lastproperty 
public var last:Point

Stores the last position of the sprite, used by collision detection algorithm.

scrollFactorproperty 
public var scrollFactor:Point

A point that can store numbers from 0 to 1 (for X and Y independently) that governs how much this object is affected by the camera subsystem. 0 means it never moves, like a HUD element or far background graphic. 1 means it scrolls along a the same speed as the foreground layer. scrollFactor is initialized as (1,1) by default.

visibleproperty 
public var visible:Boolean

If an object is not visible, the game loop will not automatically call render() on it.

widthproperty 
public var width:uint

The default value is 0.

xproperty 
public var x:Number

The default value is 0.

yproperty 
public var y:Number

The default value is 0.

Constructor detail
FlxCore()constructor
public function FlxCore()

Creates a new FlxCore object.

Method detail
collide()method
public function collide(Core:FlxCore):Boolean

Collides a FlxCore against this object. Just calls collideX() then collideY().

Parameters
Core:FlxCore — The FlxCore you want to collide.

Returns
Boolean
collideArray()method 
public function collideArray(Cores:Array):void

Collides an array of FlxCore objects against the tilemap.

Parameters
Cores:Array — The array of FlxCore objects you want to collide against.
collideArrayX()method 
public function collideArrayX(Cores:Array):void

Collides an array of FlxCore objects against the tilemap against the X axis only.

Parameters
Cores:Array — The array of FlxCore objects you want to collide against.
collideArrayY()method 
public function collideArrayY(Cores:Array):void

Collides an array of FlxCore objects against the tilemap against the Y axis only.

Parameters
Cores:Array — The array of FlxCore objects you want to collide against.
collideX()method 
public function collideX(Core:FlxCore):Boolean

Collides a FlxCore against this object on the X axis ONLY.

Parameters
Core:FlxCore — The FlxCore you want to collide.

Returns
Boolean
collideY()method 
public function collideY(Core:FlxCore):Boolean

Collides a FlxCore against this object on the Y axis ONLY.

Parameters
Core:FlxCore — The FlxCore you want to collide.

Returns
Boolean
destroy()method 
public function destroy():void

Called by FlxLayer when states are changed (if it belongs to a layer)

flicker()method 
public function flicker(Duration:Number = 1):void

Tells this object to flicker, retro-style.

Parameters
Duration:Number (default = 1) — How many seconds to flicker for.
flickering()method 
public function flickering():Boolean

Check to see if the object is still flickering.

Returns
Boolean — Whether the object is flickering or not.
getScreenXY()method 
public function getScreenXY(P:Point = null):Point

Call this function to figure out the on-screen position of the object.

Parameters
P:Point (default = null) — Takes a Point object and assigns the post-scrolled X and Y values of this object to it.

Returns
Point — The Point you passed in, or a new Point if you didn't pass one, containing the screen X and Y position of this object.
hitCeiling()method 
public function hitCeiling(Contact:FlxCore = null):Boolean

Called when this object collides with the bottom of another FlxCore.

Parameters
Contact:FlxCore (default = null)

Returns
Boolean — Whether you wish the FlxCore to collide with it or not.
hitFloor()method 
public function hitFloor(Contact:FlxCore = null):Boolean

Called when this object collides with the top of another FlxCore.

Parameters
Contact:FlxCore (default = null)

Returns
Boolean — Whether you wish the FlxCore to collide with it or not.
hitWall()method 
public function hitWall(Contact:FlxCore = null):Boolean

Called when this object collides with another FlxCore on one of its sides.

Parameters
Contact:FlxCore (default = null)

Returns
Boolean — Whether you wish the FlxCore to collide with it or not.
kill()method 
public function kill():void

Call this function to "kill" a sprite so that it no longer 'exists'.

onScreen()method 
public function onScreen():Boolean

Check and see if this object is currently on screen.

Returns
Boolean — Whether the object is on screen or not.
overlaps()method 
public function overlaps(Core:FlxCore):Boolean

Checks to see if some FlxCore object overlaps this FlxCore object.

Parameters
Core:FlxCore — The object being tested.

Returns
Boolean — Whether or not the two objects overlap.
overlapsPoint()method 
public function overlapsPoint(X:Number, Y:Number, PerPixel:Boolean = false):Boolean

Checks to see if a point in 2D space overlaps this FlxCore object.

Parameters
X:Number — The X coordinate of the point.
 
Y:Number — The Y coordinate of the point.
 
PerPixel:Boolean (default = false) — Whether or not to use per pixel collision checking (only available in FlxSprite subclass).

Returns
Boolean — Whether or not the point overlaps this object.
render()method 
public function render():void

FlxSprite and other subclasses override this to draw their contents to the screen.

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

Handy function for reviving game objects. Resets their existence flags and position, including LAST position.

Parameters
X:Number — The new X position of this object.
 
Y:Number — The new Y position of this object.
update()method 
public function update():void

Just updates the flickering. FlxSprite and other subclasses override this to do more complicated behavior.