Tilemap data. Strongly inspired from Tiled TMX format. (https://doc.mapeditor.org/en/stable/reference/tmx-map-format/).

This is a Model class, which make it suitable for (optional) serialization and observable data.

Events

@:dox(show)nameChange(current:String, previous:String):Void

Event when name field changes.

@:dox(show)orientationChange(current:TilemapOrientation, previous:TilemapOrientation):Void

Event when orientation field changes.

@:dox(show)widthChange(current:Int, previous:Int):Void

Event when width field changes.

@:dox(show)heightChange(current:Int, previous:Int):Void

Event when height field changes.

@:dox(show)renderOrderChange(current:TilemapRenderOrder, previous:TilemapRenderOrder):Void

Event when renderOrder field changes.

@:dox(show)hexSideLengthChange(current:Int, previous:Int):Void

Event when hexSideLength field changes.

@:dox(show)staggerAxisChange(current:TilemapStaggerAxis, previous:TilemapStaggerAxis):Void

Event when staggerAxis field changes.

@:dox(show)staggerIndexChange(current:TilemapStaggerIndex, previous:TilemapStaggerIndex):Void

Event when staggerIndex field changes.

@:dox(show)backgroundColorChange(current:AlphaColor, previous:AlphaColor):Void

Event when backgroundColor field changes.

@:dox(show)maxTileWidthChange(current:Int, previous:Int):Void

Event when maxTileWidth field changes.

@:dox(show)maxTileHeightChange(current:Int, previous:Int):Void

Event when maxTileHeight field changes.

@:dox(show)tilesetsChange(current:Array<Tileset>, previous:Array<Tileset>):Void

Event when tilesets field changes.

@:dox(show)layersChange(current:Array<TilemapLayerData>, previous:Array<TilemapLayerData>):Void

Event when layers field changes.

Constructor

new()

Variables

@:value(null)@serializename:String = null

The map name, if any

@:value(ORTHOGONAL)@serializeorientation:TilemapOrientation = ORTHOGONAL

Map orientation, can be ORTHOGONAL, ISOMETRIC, STAGGERED or HEXAGONAL.

@:value(-1)@serializewidth:Int = -1

The map width in pixels

@:value(-1)@serializeheight:Int = -1

The map height in pixels

@:value(RIGHT_DOWN)@serializerenderOrder:TilemapRenderOrder = RIGHT_DOWN

The order in which tiles on tile layers are rendered. In all cases, the map is drawn row-by-row.

@:value(-1)@serializehexSideLength:Int = -1

Only for hexagonal maps. Determines the width or height (depending on the staggered axis) of the tile's edge

@:value(AXIS_X)@serializestaggerAxis:TilemapStaggerAxis = AXIS_X

For staggered and hexagonal maps, determines which axis (x or y) is staggered.

@:value(ODD)@serializestaggerIndex:TilemapStaggerIndex = ODD

For staggered and hexagonal maps, determines whether the EVEN or ODD indexes along the staggered axis are shifted.

@:value(new AlphaColor(Color.WHITE, 0))@serializebackgroundColor:AlphaColor = new AlphaColor(Color.WHITE, 0)

The background color of the map.

read onlymaxTileWidth:Int

The highest tile width this tilemap is having from its layers. Computed from each tileWidth field in each layer.

Returns:

Int

read onlymaxTileHeight:Int

The highest tile height this tilemap is having from its layers. Computed from each tileHeight field in each layer.

Returns:

Int

@:value([])@serializetilesets:Array<Tileset> = []

@:value([])@serializelayers:Array<TilemapLayerData> = []

Methods

Inherited Events

Defined by Model

@:dox(show)observedDirty(instance:Model, fromSerializedField:Bool):Void

Event when any observable value as changed on this instance.

@:dox(show)_modelDirty(model:Model):Void

@:dox(show)serialize():Void

Event when this object gets serialized.

@:dox(show)deserialize():Void

Event when this object gets deserialized.

@:dox(show)dispose(entity:Entity):Void

@:dox(show)destroy(entity:Entity):Void

Inherited Variables

Defined by Model

@:value(false)observedDirty:Bool = false

Default is false, automatically set to true when any of this instance's observable variables has changed.

@:value(false)dirty:Bool = false

Defined by Entity

read onlyhasData:Bool

@:value(null)id:String = null

read onlydestroyed:Bool

read onlydisposed:Bool

@:value(null)read onlyautoruns:Array<Autorun> = null

@editablecomponents:ReadOnlyMap<String, Component>

Public components mapping. Contain components created separately with component() or macro-based components as well.

scriptContent:ScriptContent

Available with script plugin

script:Script

Available with script plugin

Inherited Methods

Defined by Model

Defined by Entity

dispose():Void

Schedules destroy, at the end of the current frame.

unbindEvents():Void

Remove all events handlers from this entity.

autorun(run:() ‑> Void, ?afterRun:() ‑> Void):Autorun

Creates a new Autorun instance with the given callback associated with the current entity.

Parameters:

run

The run callback

Returns:

The autorun instance

tween(?easing:Easing, duration:Float, fromValue:Float, toValue:Float, update:(Float, Float) ‑> Void):Tween

component<C>(?name:String, ?component:Null<C>):C