Package | org.flixel |
Class | public class FlxCore |
Subclasses | FlxBlock, FlxButton, FlxEmitter, FlxLayer, FlxPanel, FlxSound, FlxSprite, FlxTilemap |
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.
Property | Defined 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 |
Property | Defined by | ||
---|---|---|---|
_flicker : Boolean
Internal helper used for retro-style flickering.
| FlxCore | ||
_flickerTimer : Number
Internal helper used for retro-style flickering.
| FlxCore |
Method | Defined by | ||
---|---|---|---|
FlxCore()
Creates a new
FlxCore object. | FlxCore | ||
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 | ||
Collides a
FlxCore against this object on the X axis ONLY. | FlxCore | ||
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 | ||
Called when this object collides with the top of another
FlxCore . | FlxCore | ||
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 | ||
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 |
active | property |
public var active:Boolean
If an object is not alive, the game loop will not automatically call update()
on it.
dead | property |
public var dead:Boolean
If an object is dead, the functions that automate collisions will skip it (see FlxG.overlapArrays()
and FlxG.collideArrays()
).
exists | property |
public var exists:Boolean
Kind of a global on/off switch for any objects descended from FlxCore
.
fixed | property |
public var fixed:Boolean
If an object is 'fixed' in space, it will not budge when it collides with a not-fixed object.
_flicker | property |
protected var _flicker:Boolean
Internal helper used for retro-style flickering.
_flickerTimer | property |
protected var _flickerTimer:Number
Internal helper used for retro-style flickering.
height | property |
public var height:uint
The default value is 0
.
last | property |
public var last:Point
Stores the last position of the sprite, used by collision detection algorithm.
scrollFactor | property |
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.
visible | property |
public var visible:Boolean
If an object is not visible, the game loop will not automatically call render()
on it.
width | property |
public var width:uint
The default value is 0
.
x | property |
public var x:Number
The default value is 0
.
y | property |
public var y:Number
The default value is 0
.
FlxCore | () | constructor |
public function FlxCore()
Creates a new FlxCore
object.
collide | () | method |
public function collide(Core:FlxCore):Boolean
Collides a FlxCore
against this object.
Just calls collideX()
then collideY()
.
Core:FlxCore — The FlxCore you want to collide.
|
Boolean |
collideArray | () | method |
public function collideArray(Cores:Array):void
Collides an array of FlxCore
objects against the tilemap.
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.
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.
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.
Core:FlxCore — The FlxCore you want to collide.
|
Boolean |
collideY | () | method |
public function collideY(Core:FlxCore):Boolean
Collides a FlxCore
against this object on the Y axis ONLY.
Core:FlxCore — The FlxCore you want to collide.
|
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.
ParametersDuration:Number (default = 1 ) — How many seconds to flicker for.
|
flickering | () | method |
public function flickering():Boolean
Check to see if the object is still flickering.
ReturnsBoolean — 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.
ParametersP:Point (default = null ) — Takes a Point object and assigns the post-scrolled X and Y values of this object to it.
|
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
.
Contact:FlxCore (default = null )
|
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
.
Contact:FlxCore (default = null )
|
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.
Contact:FlxCore (default = null )
|
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.
ReturnsBoolean — 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.
Core:FlxCore — The object being tested.
|
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.
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).
|
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.
ParametersX: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.