Packageorg.flixel
Classpublic class FlxTileblock
InheritanceFlxTileblock Inheritance FlxSprite Inheritance FlxObject Inheritance FlxRect Inheritance FlxPoint

This is the basic "environment object" class, used to create simple walls and floors. It can be filled with a random selection of tiles to quickly add detail.



Public Properties
 PropertyDefined by
 Inheritedacceleration : FlxPoint
How fast the speed of this object is changing.
FlxObject
 Inheritedactive : Boolean
If an object is not alive, the game loop will not automatically call update() on it.
FlxObject
 Inheritedalpha : Number
Set alpha to a number between 0 and 1 to change the opacity of the sprite.
FlxSprite
 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
 Inheritedantialiasing : Boolean
Controls whether the object is smoothed when rotated, affects performance.
FlxSprite
 Inheritedblend : String
Blending modes, just like Photoshop! E.g.
FlxSprite
 Inheritedbottom : Number
The Y coordinate of the bottom of the rectangle.
FlxRect
 InheritedcolHullX : FlxRect
These store a couple of useful numbers for speeding up collision resolution.
FlxObject
 InheritedcolHullY : FlxRect
These store a couple of useful numbers for speeding up collision resolution.
FlxObject
 InheritedcollideBottom : Boolean
Flag for direction collision resolution.
FlxObject
 InheritedcollideLeft : Boolean
Flag for direction collision resolution.
FlxObject
 InheritedcollideRight : Boolean
Flag for direction collision resolution.
FlxObject
 InheritedcollideTop : Boolean
Flag for direction collision resolution.
FlxObject
 InheritedcolOffsets : Array
An array of FlxPoint objects.
FlxObject
 Inheritedcolor : uint
Set color to a number in this format: 0xRRGGBB.
FlxSprite
 InheritedcolVector : FlxPoint
These store a couple of useful numbers for speeding up collision resolution.
FlxObject
 Inheriteddead : Boolean
Handy for tracking gameplay or animations.
FlxObject
 Inheriteddrag : FlxPoint
This isn't drag exactly, more like deceleration that is only applied when acceleration is not affecting the sprite.
FlxObject
 Inheritedexists : Boolean
Kind of a global on/off switch for any objects descended from FlxObject.
FlxObject
 Inheritedfacing : uint
Set facing using FlxSprite.LEFT,RIGHT, UP, and DOWN to take advantage of flipped sprites and/or just track player orientation more easily.
FlxSprite
 Inheritedfinished : Boolean
Whether the current animation has finished its first (or only) loop.
FlxSprite
 Inheritedfixed : Boolean
Set fixed to true if you want the object to stay in place during collisions.
FlxObject
 Inheritedframe : uint
Tell the sprite to change to a specific frame of animation.
FlxSprite
 InheritedframeHeight : uint
The height of the actual graphic or image being displayed (not necessarily the game object/bounding box).
FlxSprite
 Inheritedframes : uint
The total number of frames in this image (assumes each row is full).
FlxSprite
 InheritedframeWidth : uint
The width of the actual graphic or image being displayed (not necessarily the game object/bounding box).
FlxSprite
 Inherited_group : Boolean
Dedicated internal flag for whether or not this class is a FlxGroup.
FlxObject
 Inheritedhealth : Number
Handy for storing health percentage or armor points or whatever.
FlxObject
 Inheritedheight : Number
FlxRect
 Inheritedleft : Number
The X coordinate of the left side of the rectangle.
FlxRect
 InheritedmaxAngular : Number
Use in conjunction with angularAcceleration for fluid spin speed control.
FlxObject
 InheritedmaxThrust : Number
Used to cap thrust, helpful and easy!
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
 Inheritedoffset : FlxPoint
If you changed the size of your sprite object to shrink the bounding box, you might need to offset the new bounding box from the top-left corner of the sprite.
FlxSprite
 InheritedonFloor : Boolean
Flag that indicates whether or not you just hit the floor.
FlxObject
 Inheritedorigin : FlxPoint
WARNING: The origin of the sprite will default to its center.
FlxObject
 Inheritedpixels : BitmapData
Set pixels to any BitmapData object.
FlxSprite
 Inheritedright : Number
The X coordinate of the right side of the rectangle.
FlxRect
 Inheritedscale : FlxPoint
Change the size of your sprite's graphic.
FlxSprite
 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
Set solid to true if you want to collide this object.
FlxObject
 Inheritedthrust : Number
If you want to do Asteroids style stuff, check out thrust, instead of directly accessing the object's velocity or acceleration.
FlxObject
 Inheritedtop : Number
The Y coordinate of the top of the rectangle.
FlxRect
 Inheritedvelocity : FlxPoint
The basic speed of this object.
FlxObject
 Inheritedvisible : Boolean
If an object is not visible, the game loop will not automatically call render() on it.
FlxObject
 Inheritedwidth : Number
FlxRect
 Inheritedx : Number
FlxPoint
 Inheritedy : Number
FlxPoint
Protected Properties
 PropertyDefined by
 Inherited_alpha : Number
FlxSprite
 Inherited_animations : Array
FlxSprite
 Inherited_bakedRotation : Number
FlxSprite
 Inherited_bbb : BitmapData
FlxSprite
 Inherited_boundsVisible : Boolean
FlxSprite
 Inherited_caf : uint
FlxSprite
 Inherited_callback : Function
FlxSprite
 Inherited_color : uint
FlxSprite
 Inherited_ct : ColorTransform
FlxSprite
 Inherited_curAnim : FlxAnim
FlxSprite
 Inherited_curFrame : uint
FlxSprite
 Inherited_facing : uint
FlxSprite
 Inherited_fixed : Boolean
Internal tracker for whether an object will move/alter position after a collision (see fixed).
FlxObject
 Inherited_flashPoint : Point
This is a pre-allocated Flash Point object, which is useful for certain Flash graphics API calls
FlxObject
 Inherited_flashPointZero : Point
FlxSprite
 Inherited_flashRect : Rectangle
FlxSprite
 Inherited_flashRect2 : Rectangle
FlxSprite
 Inherited_flicker : Boolean
Internal helper used for retro-style flickering.
FlxObject
 Inherited_flickerTimer : Number
Internal helper used for retro-style flickering.
FlxObject
 Inherited_flipped : uint
FlxSprite
 Inherited_framePixels : BitmapData
FlxSprite
 Inherited_frameTimer : Number
FlxSprite
 Inherited_gfx : Graphics
[static]
FlxSprite
 Inherited_gfxSprite : Sprite
[static]
FlxSprite
 Inherited_mtx : Matrix
FlxSprite
 Inherited_pixels : BitmapData
FlxSprite
 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
 Inherited_solid : Boolean
Internal tracker for whether or not the object collides (see solid).
FlxObject
Public Methods
 MethodDefined by
  
FlxTileblock(X:int, Y:int, Width:uint, Height:uint)
Creates a new FlxBlock object with the specified position and size.
FlxTileblock
 Inherited
addAnimation(Name:String, Frames:Array, FrameRate:Number = 0, Looped:Boolean = true):void
Adds a new animation to the sprite.
FlxSprite
 Inherited
addAnimationCallback(AnimationCallback:Function):void
Pass in a function to be called whenever this sprite's animation changes.
FlxSprite
 Inherited
collide(Object:FlxObject = null):Boolean
If you don't want to call FlxU.collide() you can use this instead.
FlxObject
 Inherited
createGraphic(Width:uint, Height:uint, Color:uint = 0xffffffff, Unique:Boolean = false, Key:String = null):FlxSprite
This function creates a flat colored square image dynamically.
FlxSprite
 Inherited
destroy():void
Called by FlxGroup, commonly when game states are changed.
FlxObject
 Inherited
draw(Brush:FlxSprite, X:int = 0, Y:int = 0):void
This function draws or stamps one FlxSprite onto another.
FlxSprite
 Inherited
drawLine(StartX:Number, StartY:Number, EndX:Number, EndY:Number, Color:uint, Thickness:uint = 1):void
This function draws a line on this sprite from position X1,Y1 to position X2,Y2 with the specified color.
FlxSprite
 Inherited
fill(Color:uint):void
Fills this sprite's graphic with a specific color.
FlxSprite
 Inherited
flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style.
FlxObject
 Inherited
flickering():Boolean
Check to see if the object is still flickering.
FlxObject
 Inherited
Returns the appropriate color for the bounding box depending on object state.
FlxObject
 Inherited
getScreenXY(Point:FlxPoint = null):FlxPoint
Call this function to figure out the on-screen position of the object.
FlxSprite
 Inherited
hitBottom(Contact:FlxObject, Velocity:Number):void
Called when this object's bottom edge collides with the top of another FlxObject.
FlxObject
 Inherited
hitLeft(Contact:FlxObject, Velocity:Number):void
Called when this object's left side collides with another FlxObject's right.
FlxObject
 Inherited
hitRight(Contact:FlxObject, Velocity:Number):void
Called when this object's right side collides with another FlxObject's left.
FlxObject
 Inherited
hitSide(Contact:FlxObject, Velocity:Number):void
Since most games have identical behavior for running into walls, you can just override this function instead of overriding both hitLeft and hitRight.
FlxObject
 Inherited
hitTop(Contact:FlxObject, Velocity:Number):void
Called when this object's top collides with the bottom of another FlxObject.
FlxObject
 Inherited
hurt(Damage:Number):void
Call this function to "damage" (or give health bonus) to this sprite.
FlxObject
 Inherited
kill():void
Call this function to "kill" a sprite so that it no longer 'exists'.
FlxObject
  
loadGraphic(Graphic:Class, Animated:Boolean = false, Reverse:Boolean = false, Width:uint = 0, Height:uint = 0, Unique:Boolean = false):FlxSprite
NOTE: MOST OF THE TIME YOU SHOULD BE USING LOADTILES(), NOT LOADGRAPHIC()! LoadTiles() has a lot more functionality, can load non-square tiles, etc.
FlxTileblock
 Inherited
loadRotatedGraphic(Graphic:Class, Rotations:uint = 16, Frame:int = -1, AntiAliasing:Boolean = false, AutoBuffer:Boolean = false):FlxSprite
Create a pre-rotated sprite sheet from a simple sprite.
FlxSprite
  
loadTiles(TileGraphic:Class, TileWidth:uint = 0, TileHeight:uint = 0, Empties:uint = 0):FlxTileblock
Fills the block with a randomly arranged selection of graphics from the image provided.
FlxTileblock
 Inherited
onEmit():void
Triggered whenever this sprite is launched by a FlxEmitter.
FlxSprite
 Inherited
onScreen():Boolean
Check and see if this object is currently on screen.
FlxObject
 Inherited
overlaps(Object:FlxObject):Boolean
Checks to see if some FlxObject object overlaps this FlxObject object.
FlxObject
 Inherited
overlapsPoint(X:Number, Y:Number, PerPixel:Boolean = false):Boolean
Checks to see if a point in 2D space overlaps this FlxCore object.
FlxSprite
 Inherited
play(AnimName:String, Force:Boolean = false):void
Plays an existing animation (e.g.
FlxSprite
 Inherited
preCollide(Object:FlxObject):void
FlxU.collide() (and thus FlxObject.collide()) call this function each time two objects are compared to see if they collide.
FlxObject
 Inherited
randomFrame():void
Tell the sprite to change to a random frame of animation Useful for instantiating particles or other weird things.
FlxSprite
 Inherited
refreshHulls():void
Called by FlxObject.updateMotion() and some constructors to rebuild the basic collision data for this object.
FlxObject
 Inherited
render():void
Called by game loop, updates then blits or renders current frame of animation to the screen
FlxSprite
 Inherited
reset(X:Number, Y:Number):void
Handy function for reviving game objects.
FlxObject
 Inherited
toString():String
Convert object to readable string name.
FlxPoint
 Inherited
unsafeBind(Pixels:BitmapData):void
Internal function, currently only used to quickly update FlxState.screen for post-processing.
FlxSprite
 Inherited
update():void
Main game loop update function.
FlxSprite
Protected Methods
 MethodDefined by
 Inherited
calcFrame():void
Internal function to update the current animation frame.
FlxSprite
 Inherited
drawBounds():void
FlxSprite
 Inherited
renderSprite():void
Internal function that performs the actual sprite rendering, called by render().
FlxSprite
 Inherited
resetHelpers():void
Resets some important variables for sprite optimization and rendering.
FlxSprite
 Inherited
Internal function for updating the sprite's animation.
FlxSprite
 Inherited
Just updates the retro-style flickering.
FlxObject
 Inherited
updateMotion():void
Internal function for updating the position and speed of this object.
FlxObject
Public Constants
 ConstantDefined by
 InheritedDOWN : uint = 3
[static] Useful for checking player orientation.
FlxSprite
 InheritedLEFT : uint = 0
[static] Useful for controlling flipped animations and checking player orientation.
FlxSprite
 InheritedRIGHT : uint = 1
[static] Useful for controlling flipped animations and checking player orientation.
FlxSprite
 InheritedUP : uint = 2
[static] Useful for checking player orientation.
FlxSprite
Protected Constants
 ConstantDefined by
 Inherited_pZero : FlxPoint
[static] A handy "empty point" object
FlxObject
Constructor detail
FlxTileblock()constructor
public function FlxTileblock(X:int, Y:int, Width:uint, Height:uint)

Creates a new FlxBlock object with the specified position and size.

Parameters
X:int — The X position of the block.
 
Y:int — The Y position of the block.
 
Width:uint — The width of the block.
 
Height:uint — The height of the block.
Method detail
loadGraphic()method
public override function loadGraphic(Graphic:Class, Animated:Boolean = false, Reverse:Boolean = false, Width:uint = 0, Height:uint = 0, Unique:Boolean = false):FlxSprite

NOTE: MOST OF THE TIME YOU SHOULD BE USING LOADTILES(), NOT LOADGRAPHIC()! LoadTiles() has a lot more functionality, can load non-square tiles, etc. Load an image from an embedded graphic file and use it to auto-fill this block with tiles.

Parameters
Graphic:Class — The image you want to use.
 
Animated:Boolean (default = false) — Ignored.
 
Reverse:Boolean (default = false) — Ignored.
 
Width:uint (default = 0) — Ignored.
 
Height:uint (default = 0) — Ignored.
 
Unique:Boolean (default = false) — Ignored.

Returns
FlxSprite — This FlxSprite instance (nice for chaining stuff together, if you're into that).
loadTiles()method 
public function loadTiles(TileGraphic:Class, TileWidth:uint = 0, TileHeight:uint = 0, Empties:uint = 0):FlxTileblock

Fills the block with a randomly arranged selection of graphics from the image provided.

Parameters
TileGraphic:Class — The graphic class that contains the tiles that should fill this block.
 
TileWidth:uint (default = 0) — The number of "empty" tiles to add to the auto-fill algorithm (e.g. 8 tiles + 4 empties = 1/3 of block will be open holes).
 
TileHeight:uint (default = 0)
 
Empties:uint (default = 0)

Returns
FlxTileblock