FlxBlock always chooses a random graphic from your TileGraphic:Class, which isn't right if you want to design your own levels in a way that's more involved than simply defining areas of certain blocks. So I added a parameter to the FlxBlock constructor, TileID, that allows you to select which piece of the image you want to use:
//@desc Constructor
//@param X The X position of the block
//@param Y The Y position of the block
//@param Width The width of the block
//@param Height The height of the block
//@param TileGraphic The graphic class that contains the tiles that should fill this block
//@param Empties 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)
//@param TileID Which number tile to use (negative results in random)
public function FlxBlock(X:int, Y:int, Width:uint, Height:uint, TileGraphic:Class, Empties:uint = 0, TileID:int=-1)
{
super();
x = X;
y = Y;
width = Width;
height = Height;
if(TileGraphic == null)
return;
_pixels = FlxG.addBitmap(TileGraphic);
_rects = new FlxArray();
_p = new Point();
_tileSize = _pixels.height;
var widthInTiles:uint = Math.ceil(width/_tileSize);
var heightInTiles:uint = Math.ceil(height/_tileSize);
width = widthInTiles*_tileSize;
height = heightInTiles*_tileSize;
var numTiles:uint = widthInTiles*heightInTiles;
var numGraphics:uint = _pixels.width/_tileSize;
for(var i:uint = 0; i < numTiles; i++)
{
if((Math.random()*(numGraphics+Empties) > Empties) && (TileID<=-1)) {
_rects.push(new Rectangle(_tileSize * Math.floor(Math.random() * numGraphics), 0, _tileSize, _tileSize));
} else if ((Math.random() * (numGraphics + Empties) > Empties) && (TileID > -1)) {
_rects.push(new Rectangle(_tileSize * TileID, 0, _tileSize, _tileSize));
} else {
_rects.push(null);
}
}
}
The original case is preserved so you can probably just replace the constructor in FlxBlock.as if you want to and it shouldn't hurt anything.