The Tileset class lets you specify logical rectangles within a larger BitmapData object, to be rendered using a Tilemap instance.
The Tileset() constructor allows you to create a Tileset
object that contains a reference to a BitmapData object. After you create a
Tileset object, use the addRect() method to specify rectangles to be used
for tile rendering.
Constructor
new(bitmapData:BitmapData, ?rects:Array<Rectangle>)
Creates a new Tileset instance.
Parameters:
bitmapData | A BitmapData object to reference  | 
|---|---|
rects | An optional array of rectangles to define with the referenced BitmapData  | 
Variables
Methods
addRect(rect:Rectangle):Int
Adds a new rectangle to this Tilemap object.
Parameters:
rect | A Rectangle represented a part of the referenced BitmapData object  | 
|---|
Returns:
The assigned ID value for this new rectangle
clone():Tileset
Duplicates an instance of a Tileset subclass.
Returns:
A new Tileset object that is identical to the original.
getRect(id:Int):Rectangle
Get the rectangle value associated with a specific tile ID.
If the ID is invalid, then a null value will be returned.
Parameters:
id | A tile ID  | 
|---|
Returns:
A new Rectangle containing the tile source rectangle, or null if the
tile ID does not exist in this Tileset
getRectID(rect:Rectangle):Null<Int>
Gets the tile ID associated with a specified rectangle
value, if it is defined in the Tileset. This will return
null if the rectangle value is not defined in the Tileset.
Parameters:
rect | A Rectangle object to compare against  | 
|---|
Returns:
The defined tile ID, or null if the rectangle
value is not present in this Tileset