Package | org.flixel.system |
Class | public class FlxTile |
Inheritance | FlxTile FlxObject FlxBasic Object |
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.
Property | Defined By | ||
---|---|---|---|
acceleration : FlxPoint
How fast the speed of this object is changing. | FlxObject | ||
active : Boolean
Controls whether update() is automatically called by FlxState/FlxGroup. | FlxBasic | ||
_ACTIVECOUNT : uint [static] | FlxBasic | ||
alive : Boolean
Useful state for many game objects - "dead" (!alive) vs alive. | FlxBasic | ||
allowCollisions : uint
Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating collision directions. | FlxObject | ||
angle : Number
Set the angle of a sprite to rotate it. | FlxObject | ||
angularAcceleration : Number
How fast the spin speed should change. | FlxObject | ||
angularDrag : Number
Like drag but for spinning. | FlxObject | ||
angularVelocity : 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 | ||
cameras : Array
An array of camera objects that this object will use during draw(). | FlxBasic | ||
drag : FlxPoint
This isn't drag exactly, more like deceleration that is only applied
when acceleration is not affecting the sprite. | FlxObject | ||
elasticity : Number
The bounciness of this object. | FlxObject | ||
exists : 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 | ||
flickering : Boolean [read-only]
Check to see if the object is still flickering. | FlxObject | ||
health : Number
Handy for storing health percentage or armor points or whatever. | FlxObject | ||
height : Number
The height of this object. | FlxObject | ||
ID : int
IDs seem like they could be pretty useful, huh?
They're not actually used for anything yet though. | FlxBasic | ||
ignoreDrawDebug : Boolean
Setting this to true will prevent the object from appearing
when the visual debug mode in the debugger overlay is toggled on. | FlxBasic | ||
immovable : 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 | ||
last : FlxPoint
Important variable for collision processing. | FlxObject | ||
mapIndex : uint
The current map index of this tile object at this moment. | FlxTile | ||
mass : Number
The virtual mass of the object. | FlxObject | ||
maxAngular : Number
Use in conjunction with angularAcceleration for fluid spin speed control. | FlxObject | ||
maxVelocity : FlxPoint
If you are using acceleration, you can use maxVelocity with it
to cap the speed automatically (very useful!). | FlxObject | ||
moves : Boolean
Set this to false if you want to skip the automatic motion/movement stuff (see updateMotion()). | FlxObject | ||
path : FlxPath
A reference to a path object. | FlxObject | ||
pathAngle : Number
The angle in degrees between this object and the next node, where 0 is directly upward, and 90 is to the right. | FlxObject | ||
pathSpeed : Number
The speed at which the object is moving on the path. | FlxObject | ||
scrollFactor : 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 | ||
solid : Boolean
Whether the object collides or not. | FlxObject | ||
tilemap : FlxTilemap
A reference to the tilemap this tile object belongs to. | FlxTile | ||
touching : uint
Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts. | FlxObject | ||
velocity : FlxPoint
The basic speed of this object. | FlxObject | ||
visible : Boolean
Controls whether draw() is automatically called by FlxState/FlxGroup. | FlxBasic | ||
_VISIBLECOUNT : uint [static] | FlxBasic | ||
wasTouching : uint
Bit field of flags (use with UP, DOWN, LEFT, RIGHT, etc) indicating surface contacts from the previous game loop step. | FlxObject | ||
width : Number
The width of this object. | FlxObject | ||
x : Number
X position of the upper left corner of this object in world space. | FlxObject | ||
y : Number
Y position of the upper left corner of this object in world space. | FlxObject |
Method | Defined 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 | ||
draw():void [override]
Rarely called, and in this case just increments the visible objects count and calls drawDebug() if necessary. | FlxObject | ||
[override]
Override this function to draw custom "debug mode" graphics to the
specified camera while the debugger's visual mode is toggled on. | FlxObject | ||
flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style. | FlxObject | ||
followPath(Path:FlxPath, Speed:Number = 100, Mode:uint, AutoRotate:Boolean = false):void
Call this function to give this object a path to follow. | FlxObject | ||
Retrieve the midpoint of this object in world coordinates. | FlxObject | ||
Call this function to figure out the on-screen position of the object. | FlxObject | ||
hurt(Damage:Number):void
Reduces the "health" variable of this sprite by the amount specified in Damage. | FlxObject | ||
isTouching(Direction:uint):Boolean
Handy function for checking if this object is touching a particular surface. | FlxObject | ||
justTouched(Direction:uint):Boolean
Handy function for checking if this object is just landed on a particular surface. | FlxObject | ||
kill():void
Handy function for "killing" game objects. | FlxBasic | ||
Check and see if this object is currently on screen. | FlxObject | ||
Checks to see if some FlxObject overlaps this FlxObject or FlxGroup. | FlxObject | ||
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 | ||
Checks to see if a point in 2D world space overlaps this FlxObject object. | FlxObject | ||
postUpdate():void [override]
Post-update is called right after update() on each object in the game loop. | FlxObject | ||
preUpdate():void [override]
Pre-update is called right before update() on each object in the game loop. | FlxObject | ||
reset(X:Number, Y:Number):void
Handy function for reviving game objects. | FlxObject | ||
revive():void
Handy function for bringing game objects "back to life". | FlxBasic | ||
[static]
The main collision resolution function in flixel. | FlxObject | ||
[static]
The X-axis component of the object separation process. | FlxObject | ||
[static]
The Y-axis component of the object separation process. | FlxObject | ||
stopFollowingPath(DestroyPath:Boolean = false):void
Tells this object to stop following the path its on. | FlxObject | ||
toString():String
Convert object to readable string name. | FlxBasic | ||
update():void
Override this function to update your class's position and appearance. | FlxBasic |
callback | property |
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()
.
filter | property |
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()
.
index | property |
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.
mapIndex | property |
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.
tilemap | property |
public var tilemap:FlxTilemap
A reference to the tilemap this tile object belongs to.
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()
.
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().
|
destroy | () | method |
override public function destroy():void
Clean up memory.