Packageorg.flixel
Classpublic class FlxTileblock
InheritanceFlxTileblock 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
 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
 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
 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
 Inheritedfixed : Boolean
If an object is 'fixed' in space, it will not budge when it collides with a not-fixed object.
FlxObject
 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
 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
 Inheritedright : Number
The X coordinate of the right side of the rectangle.
FlxRect
 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
If an object is dead, the functions that automate collisions will skip it (see FlxG.overlapArrays() and FlxG.collideArrays()).
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_flashPoint : Point
This is a pre-allocated Flash Point object, which is useful for certain Flash graphics API calls
FlxObject
  _flashRect : Rectangle
Rendering helper.
FlxTileblock
 Inherited_flicker : Boolean
Internal helper used for retro-style flickering.
FlxObject
 Inherited_flickerTimer : Number
Internal helper used for retro-style flickering.
FlxObject
  _pixels : BitmapData
Stores the tile strip from which the tiles are loaded.
FlxTileblock
 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
  _rects : Array
Array of rectangles used to quickly blit the tiles to the screen.
FlxTileblock
  _tileSize : uint
The size of the tiles (e.g.
FlxTileblock
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
collide(Object:FlxObject = null):Boolean
If you don't want to call FlxU.collide() you can use this instead.
FlxObject
 Inherited
destroy():void
Called by FlxGroup, commonly when game states are changed.
FlxObject
 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
getScreenXY(Point:FlxPoint = null):FlxPoint
Call this function to figure out the on-screen position of the object.
FlxObject
 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
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(TileGraphic:Class, Empties:uint = 0):void
Fills the block with a randomly arranged selection of graphics from the image provided.
FlxTileblock
 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 FlxObject object.
FlxObject
 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
refreshHulls():void
Called by FlxObject.updateMotion() and some constructors to rebuild the basic collision data for this object.
FlxObject
  
render():void
Draws this block.
FlxTileblock
 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
update():void
Called by the main game loop, handles motion/physics and game logic
FlxObject
Protected Methods
 MethodDefined by
  
renderBlock():void
Internal function to draw this block
FlxTileblock
 Inherited
Just updates the retro-style flickering.
FlxObject
 Inherited
updateMotion():void
Internal function for updating the position and speed of this object.
FlxObject
Protected Constants
 ConstantDefined by
 Inherited_pZero : FlxPoint
[static] A handy "empty point" object
FlxObject
Property detail
_flashRectproperty
protected var _flashRect:Rectangle

Rendering helper.

_pixelsproperty 
protected var _pixels:BitmapData

Stores the tile strip from which the tiles are loaded.

_rectsproperty 
protected var _rects:Array

Array of rectangles used to quickly blit the tiles to the screen.

_tileSizeproperty 
protected var _tileSize:uint

The size of the tiles (e.g. 8 means 8x8).

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 function loadGraphic(TileGraphic:Class, Empties:uint = 0):void

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.
 
Empties: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).
render()method 
public override function render():void

Draws this block.

renderBlock()method 
protected function renderBlock():void

Internal function to draw this block