Packageorg.flixel
Classpublic class FlxBlock
InheritanceFlxBlock Inheritance FlxCore

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
 Inheritedactive : Boolean
If an object is not alive, the game loop will not automatically call update() on it.
FlxCore
 Inheriteddead : Boolean
If an object is dead, the functions that automate collisions will skip it (see FlxG.overlapArrays() and FlxG.collideArrays()).
FlxCore
 Inheritedexists : Boolean
Kind of a global on/off switch for any objects descended from FlxCore.
FlxCore
 Inheritedfixed : Boolean
If an object is 'fixed' in space, it will not budge when it collides with a not-fixed object.
FlxCore
 Inheritedheight : uint
FlxCore
 Inheritedlast : Point
Stores the last position of the sprite, used by collision detection algorithm.
FlxCore
 InheritedscrollFactor : 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
 Inheritedvisible : Boolean
If an object is not visible, the game loop will not automatically call render() on it.
FlxCore
 Inheritedwidth : uint
FlxCore
 Inheritedx : Number
FlxCore
 Inheritedy : Number
FlxCore
Protected Properties
 PropertyDefined by
 Inherited_flicker : Boolean
Internal helper used for retro-style flickering.
FlxCore
 Inherited_flickerTimer : Number
Internal helper used for retro-style flickering.
FlxCore
  _p : Point
Helper variable used during rendering.
FlxBlock
  _pixels : BitmapData
Stores the tile strip from which the tiles are loaded.
FlxBlock
  _rects : Array
Array of rectangles used to quickly blit the tiles to the screen.
FlxBlock
  _tileSize : uint
The size of the tiles (e.g.
FlxBlock
Public Methods
 MethodDefined by
  
FlxBlock(X:int, Y:int, Width:uint, Height:uint)
Creates a new FlxBlock object with the specified position and size.
FlxBlock
 Inherited
collide(Core:FlxCore):Boolean
Collides a FlxCore against this object.
FlxCore
 Inherited
collideArray(Cores:Array):void
Collides an array of FlxCore objects against the tilemap.
FlxCore
 Inherited
collideArrayX(Cores:Array):void
Collides an array of FlxCore objects against the tilemap against the X axis only.
FlxCore
 Inherited
collideArrayY(Cores:Array):void
Collides an array of FlxCore objects against the tilemap against the Y axis only.
FlxCore
 Inherited
collideX(Core:FlxCore):Boolean
Collides a FlxCore against this object on the X axis ONLY.
FlxCore
 Inherited
collideY(Core:FlxCore):Boolean
Collides a FlxCore against this object on the Y axis ONLY.
FlxCore
 Inherited
destroy():void
Called by FlxLayer when states are changed (if it belongs to a layer)
FlxCore
 Inherited
flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style.
FlxCore
 Inherited
flickering():Boolean
Check to see if the object is still flickering.
FlxCore
 Inherited
getScreenXY(P:Point = null):Point
Call this function to figure out the on-screen position of the object.
FlxCore
 Inherited
hitCeiling(Contact:FlxCore = null):Boolean
Called when this object collides with the bottom of another FlxCore.
FlxCore
 Inherited
hitFloor(Contact:FlxCore = null):Boolean
Called when this object collides with the top of another FlxCore.
FlxCore
 Inherited
hitWall(Contact:FlxCore = null):Boolean
Called when this object collides with another FlxCore on one of its sides.
FlxCore
 Inherited
kill():void
Call this function to "kill" a sprite so that it no longer 'exists'.
FlxCore
  
loadGraphic(TileGraphic:Class, Empties:uint = 0):void
Fills the block with a randomly arranged selection of graphics from the image provided.
FlxBlock
 Inherited
onScreen():Boolean
Check and see if this object is currently on screen.
FlxCore
 Inherited
overlaps(Core:FlxCore):Boolean
Checks to see if some FlxCore object overlaps this FlxCore object.
FlxCore
 Inherited
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
Draws this block.
FlxBlock
 Inherited
reset(X:Number, Y:Number):void
Handy function for reviving game objects.
FlxCore
 Inherited
update():void
Just updates the flickering.
FlxCore
Property detail
_pproperty
protected var _p:Point

Helper variable used during rendering.

_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
FlxBlock()constructor
public function FlxBlock(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.