Packageorg.flixel.system
Classpublic class FlxTile
InheritanceFlxTile Inheritance FlxObject Inheritance FlxBasic Inheritance Object

A simple helper object for FlxTilemap that helps expand collision opportunities and control. You can use FlxTilemap.setTileProperties() to alter the collision properties and callback functions and filters for this object to do things like one-way tiles or whatever.



Public Properties
 PropertyDefined By
 Inheritedacceleration : FlxPoint
How fast the speed of this object is changing.
FlxObject
 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
 InheritedallowCollisions : uint
Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating collision directions.
FlxObject
 Inheritedangle : Number
Set the angle of a sprite to rotate it.
FlxObject
 InheritedangularAcceleration : Number
How fast the spin speed should change.
FlxObject
 InheritedangularDrag : Number
Like drag but for spinning.
FlxObject
 InheritedangularVelocity : Number
This is how fast you want this sprite to spin.
FlxObject
  callback : Function
This function is called whenever an object hits a tile of this type.
FlxTile
 Inheritedcameras : Array
An array of camera objects that this object will use during draw().
FlxBasic
 Inheriteddrag : FlxPoint
This isn't drag exactly, more like deceleration that is only applied when acceleration is not affecting the sprite.
FlxObject
 Inheritedelasticity : Number
The bounciness of this object.
FlxObject
 Inheritedexists : Boolean
Controls whether update() and draw() are automatically called by FlxState/FlxGroup.
FlxBasic
  filter : Class
Each tile can store its own filter class for their callback functions.
FlxTile
 Inheritedflickering : Boolean
[read-only] Check to see if the object is still flickering.
FlxObject
 Inheritedhealth : Number
Handy for storing health percentage or armor points or whatever.
FlxObject
 Inheritedheight : Number
The height of this object.
FlxObject
 InheritedID : int
IDs seem like they could be pretty useful, huh? They're not actually used for anything yet though.
FlxBasic
 InheritedignoreDrawDebug : Boolean
Setting this to true will prevent the object from appearing when the visual debug mode in the debugger overlay is toggled on.
FlxBasic
 Inheritedimmovable : Boolean
Whether an object will move/alter position after a collision.
FlxObject
  index : uint
The index of this tile type in the core map data.
FlxTile
 Inheritedlast : FlxPoint
Important variable for collision processing.
FlxObject
  mapIndex : uint
The current map index of this tile object at this moment.
FlxTile
 Inheritedmass : Number
The virtual mass of the object.
FlxObject
 InheritedmaxAngular : Number
Use in conjunction with angularAcceleration for fluid spin speed control.
FlxObject
 InheritedmaxVelocity : FlxPoint
If you are using acceleration, you can use maxVelocity with it to cap the speed automatically (very useful!).
FlxObject
 Inheritedmoves : Boolean
Set this to false if you want to skip the automatic motion/movement stuff (see updateMotion()).
FlxObject
 Inheritedpath : FlxPath
A reference to a path object.
FlxObject
 InheritedpathAngle : Number
The angle in degrees between this object and the next node, where 0 is directly upward, and 90 is to the right.
FlxObject
 InheritedpathSpeed : Number
The speed at which the object is moving on the path.
FlxObject
 InheritedscrollFactor : FlxPoint
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.
FlxObject
 Inheritedsolid : Boolean
Whether the object collides or not.
FlxObject
  tilemap : FlxTilemap
A reference to the tilemap this tile object belongs to.
FlxTile
 Inheritedtouching : uint
Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts.
FlxObject
 Inheritedvelocity : FlxPoint
The basic speed of this object.
FlxObject
 Inheritedvisible : Boolean
Controls whether draw() is automatically called by FlxState/FlxGroup.
FlxBasic
 Inherited_VISIBLECOUNT : uint
[static]
FlxBasic
 InheritedwasTouching : uint
Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts from the previous game loop step.
FlxObject
 Inheritedwidth : Number
The width of this object.
FlxObject
 Inheritedx : Number
X position of the upper left corner of this object in world space.
FlxObject
 Inheritedy : Number
Y position of the upper left corner of this object in world space.
FlxObject
Protected Properties
 PropertyDefined By
 Inherited_flicker : Boolean
Internal helper used for retro-style flickering.
FlxObject
 Inherited_flickerTimer : Number
Internal helper used for retro-style flickering.
FlxObject
 Inherited_pathInc : int
Internal helper for node navigation, specifically yo-yo and backwards movement.
FlxObject
 Inherited_pathMode : uint
Internal tracker for path behavior flags (like looping, horizontal only, etc).
FlxObject
 Inherited_pathNodeIndex : int
Internal helper, tracks which node of the path this object is moving toward.
FlxObject
 Inherited_pathRotate : Boolean
Internal flag for whether hte object's angle should be adjusted to the path angle during path follow behavior.
FlxObject
 Inherited_point : FlxPoint
This is just a pre-allocated x-y point container to be used however you like
FlxObject
 Inherited_rect : FlxRect
This is just a pre-allocated rectangle container to be used however you like
FlxObject
Public Methods
 MethodDefined By
  
FlxTile(Tilemap:FlxTilemap, Index:uint, Width:Number, Height:Number, Visible:Boolean, AllowCollisions:uint)
Instantiate this new tile object.
FlxTile
  
destroy():void
[override] Clean up memory.
FlxTile
 Inherited
draw():void
[override] Rarely called, and in this case just increments the visible objects count and calls drawDebug() if necessary.
FlxObject
 Inherited
drawDebug(Camera:FlxCamera = null):void
[override] Override this function to draw custom "debug mode" graphics to the specified camera while the debugger's visual mode is toggled on.
FlxObject
 Inherited
flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style.
FlxObject
 Inherited
followPath(Path:FlxPath, Speed:Number = 100, Mode:uint, AutoRotate:Boolean = false):void
Call this function to give this object a path to follow.
FlxObject
 Inherited
Retrieve the midpoint of this object in world coordinates.
FlxObject
 Inherited
getScreenXY(Point:FlxPoint = null, Camera:FlxCamera = null):FlxPoint
Call this function to figure out the on-screen position of the object.
FlxObject
 Inherited
hurt(Damage:Number):void
Reduces the "health" variable of this sprite by the amount specified in Damage.
FlxObject
 Inherited
isTouching(Direction:uint):Boolean
Handy function for checking if this object is touching a particular surface.
FlxObject
 Inherited
justTouched(Direction:uint):Boolean
Handy function for checking if this object is just landed on a particular surface.
FlxObject
 Inherited
kill():void
Handy function for "killing" game objects.
FlxBasic
 Inherited
onScreen(Camera:FlxCamera = null):Boolean
Check and see if this object is currently on screen.
FlxObject
 Inherited
overlaps(ObjectOrGroup:FlxBasic, InScreenSpace:Boolean = false, Camera:FlxCamera = null):Boolean
Checks to see if some FlxObject overlaps this FlxObject or FlxGroup.
FlxObject
 Inherited
overlapsAt(X:Number, Y:Number, ObjectOrGroup:FlxBasic, InScreenSpace:Boolean = false, Camera:FlxCamera = null):Boolean
Checks to see if this FlxObject were located at the given position, would it overlap the FlxObject or FlxGroup? This is distinct from overlapsPoint(), which just checks that point, rather than taking the object's size into account.
FlxObject
 Inherited
overlapsPoint(Point:FlxPoint, InScreenSpace:Boolean = false, Camera:FlxCamera = null):Boolean
Checks to see if a point in 2D world space overlaps this FlxObject object.
FlxObject
 Inherited
postUpdate():void
[override] Post-update is called right after update() on each object in the game loop.
FlxObject
 Inherited
preUpdate():void
[override] Pre-update is called right before update() on each object in the game loop.
FlxObject
 Inherited
reset(X:Number, Y:Number):void
Handy function for reviving game objects.
FlxObject
 Inherited
revive():void
Handy function for bringing game objects "back to life".
FlxBasic
 Inherited
separate(Object1:FlxObject, Object2:FlxObject):Boolean
[static] The main collision resolution function in flixel.
FlxObject
 Inherited
separateX(Object1:FlxObject, Object2:FlxObject):Boolean
[static] The X-axis component of the object separation process.
FlxObject
 Inherited
separateY(Object1:FlxObject, Object2:FlxObject):Boolean
[static] The Y-axis component of the object separation process.
FlxObject
 Inherited
stopFollowingPath(DestroyPath:Boolean = false):void
Tells this object to stop following the path its on.
FlxObject
 Inherited
toString():String
Convert object to readable string name.
FlxBasic
 Inherited
update():void
Override this function to update your class's position and appearance.
FlxBasic
Protected Methods
 MethodDefined By
 Inherited
advancePath(Snap:Boolean = true):FlxPoint
Internal function that decides what node in the path to aim for next based on the behavior flags.
FlxObject
 Inherited
Internal function for updating the position and speed of this object.
FlxObject
 Inherited
Internal function for moving the object along the path.
FlxObject
Public Constants
 ConstantDefined By
 InheritedANY : uint
[static] Special-case constant meaning any direction, used mainly by allowCollisions and touching.
FlxObject
 InheritedCEILING : uint = 0x0100
[static] Special-case constant meaning up, used mainly by allowCollisions and touching.
FlxObject
 InheritedDOWN : uint = 0x1000
[static] Generic value for "down" Used by facing, allowCollisions, and touching.
FlxObject
 InheritedFLOOR : uint = 0x1000
[static] Special-case constant meaning down, used mainly by allowCollisions and touching.
FlxObject
 InheritedLEFT : uint = 0x0001
[static] Generic value for "left" Used by facing, allowCollisions, and touching.
FlxObject
 InheritedNONE : uint = 0
[static] Special-case constant meaning no collisions, used mainly by allowCollisions and touching.
FlxObject
 InheritedOVERLAP_BIAS : Number = 4
[static] Handy constant used during collision resolution (see separateX() and separateY()).
FlxObject
 InheritedPATH_BACKWARD : uint = 0x000001
[static] Path behavior controls: move from the end of the path to the start then stop.
FlxObject
 InheritedPATH_FORWARD : uint = 0x000000
[static] Path behavior controls: move from the start of the path to the end then stop.
FlxObject
 InheritedPATH_HORIZONTAL_ONLY : uint = 0x010000
[static] Path behavior controls: ignores any vertical component to the path data, only follows side to side.
FlxObject
 InheritedPATH_LOOP_BACKWARD : uint = 0x000100
[static] Path behavior controls: move from the end of the path to the start then directly back to the end, and start over.
FlxObject
 InheritedPATH_LOOP_FORWARD : uint = 0x000010
[static] Path behavior controls: move from the start of the path to the end then directly back to the start, and start over.
FlxObject
 InheritedPATH_VERTICAL_ONLY : uint = 0x100000
[static] Path behavior controls: ignores any horizontal component to the path data, only follows up and down.
FlxObject
 InheritedPATH_YOYO : uint = 0x001000
[static] Path behavior controls: move from the start of the path to the end then turn around and go back to the start, over and over.
FlxObject
 InheritedRIGHT : uint = 0x0010
[static] Generic value for "right" Used by facing, allowCollisions, and touching.
FlxObject
 InheritedUP : uint = 0x0100
[static] Generic value for "up" Used by facing, allowCollisions, and touching.
FlxObject
 InheritedWALL : uint
[static] Special-case constant meaning only the left and right sides, used mainly by allowCollisions and touching.
FlxObject
Protected Constants
 ConstantDefined By
 Inherited_pZero : FlxPoint
[static] Should always represent (0,0) - useful for different things, for avoiding unnecessary new calls.
FlxObject
Property Detail
callbackproperty
public var callback:Function

This function is called whenever an object hits a tile of this type. This function should take the form myFunction(Tile:FlxTile,Object:FlxObject):void. Defaults to null, set through FlxTilemap.setTileProperties().

filterproperty 
public var filter:Class

Each tile can store its own filter class for their callback functions. That is, the callback will only be triggered if an object with a class type matching the filter touched it. Defaults to null, set through FlxTilemap.setTileProperties().

indexproperty 
public var index:uint

The index of this tile type in the core map data. For example, if your map only has 16 kinds of tiles in it, this number is usually between 0 and 15.

mapIndexproperty 
public var mapIndex:uint

The current map index of this tile object at this moment. You can think of tile objects as moving around the tilemap helping with collisions. This value is only reliable and useful if used from the callback function.

tilemapproperty 
public var tilemap:FlxTilemap

A reference to the tilemap this tile object belongs to.

Constructor Detail
FlxTile()Constructor
public function FlxTile(Tilemap:FlxTilemap, Index:uint, Width:Number, Height:Number, Visible:Boolean, AllowCollisions:uint)

Instantiate this new tile object. This is usually called from FlxTilemap.loadMap().

Parameters
Tilemap:FlxTilemap — A reference to the tilemap object creating the tile.
 
Index:uint — The actual core map data index for this tile type.
 
Width:Number — The width of the tile.
 
Height:Number — The height of the tile.
 
Visible:Boolean — Whether the tile is visible or not.
 
AllowCollisions:uint — The collision flags for the object. By default this value is ANY or NONE depending on the parameters sent to loadMap().
Method Detail
destroy()method
override public function destroy():void

Clean up memory.