Skip to content

Latest commit

 

History

History
157 lines (145 loc) · 10.3 KB

JSON_DOC.md

File metadata and controls

157 lines (145 loc) · 10.3 KB

Json structure (version 0.4.0-beta)

Please refer to the README.md for more informations.

Json root

Value Type Description
bgColor String Project background color
defaultGridSize Int Default grid size for new layers
defaultPivotX Float Default X pivot (0 to 1) for new entities
defaultPivotY Float Default Y pivot (0 to 1) for new entities
defs Definitions A structure containing all the definitions of this project
exportTiled Bool If TRUE, a Tiled compatible file will also be generated along with the LEd JSON file.
jsonVersion String File format version
levels Array of Level
minifyJson Bool If TRUE, the Json is partially minified (no indentation, nor line breaks)

1. Level

Value Type Description
identifier String Unique String identifier
layerInstances Array of Layer instance
pxHei Int Height of the level in pixels
pxWid Int Width of the level in pixels
uid Int Unique Int identifier

1.1. Layer instance

Value Type Description
__cHei Int Grid-based height
__cWid Int Grid-based width
__gridSize Int Grid size
__identifier String Unique String identifier
__opacity
Generic badge
Float Layer opacity as Float [0-1]
__type String Layer type (possible values: IntGrid, Entities, Tiles or AutoLayer)
autoLayerTiles
Only Auto-layers
Generic badge
Array of Tile instance An array containing all tiles generated by Auto-layer rules. The array is already sorted in display order (ie. 1st tile is beneath 2nd, which is beneath 3rd etc.)
entityInstances
Only Entity layers
Array of Entity instance
gridTiles
Only Tile layers
Array of Tile instance
intGrid
Only IntGrid layers
Array of Object This object contains the following fields:
  • coordId (Int) : Coordinate ID in the layer grid
  • v (Int) : IntGrid value
layerDefUid Int Reference the Layer definition UID
levelId Int Reference to the UID of the level containing this layer instance
pxOffsetX Int Horizontal offset in pixels to render this layer, usually 0
pxOffsetY Int Vertical offset in pixels to render this layer, usually 0
seed
Only Auto-layers
Int Random seed used for Auto-Layers rendering

1.1.1. Tile instance Generic badge

Value Type Description
d Array of Int Internal data used by the editor.
For auto-layer tiles: [ruleId, coordId, tileId].
For tile-layer tiles: [coordId, tileId].
f Int "Flip flags", a 2-bits integer to represent the mirror transformations of the tile.
- Bit 0 = X flip
- Bit 1 = Y flip
px Array of Int Pixel coordinates of the tile in the layer ([x,y] format)
src Array of Int Pixel coordinates of the tile in the tileset ([x,y] format)

1.1.2. Entity instance

Value Type Description
__grid
Generic badge
Array of Int Grid-based coordinates ([x,y] format)
__identifier String Unique String identifier
__tile
Generic badge
Object (can be null) Optional Tile used to display this entity (it could either be the default Entity tile, or some tile provided by a field value, like an Enum).
This object contains the following fields:
  • srcRect (Array of Int) : An array of 4 Int values that refers to the tile in the tileset image: [ x, y, width, height ]
  • tilesetUid (Int) : Tileset ID
defUid Int Reference of the Entity definition UID
fieldInstances Array of Field instance
px
Generic badge
Array of Int Pixel coordinates ([x,y] format)

1.1.3. Field instance

Value Type Description
__identifier String Unique String identifier
__type String Type of the field, such as Int, Float, Enum(enum_name), Bool, etc.
__value Dynamic (anything) Actual value of the field instance. The value type may vary, depending on __type (Integer, Boolean, String etc.)
It can also be an Array of various types.
defUid Int Reference of the Field definition UID

2. Definitions

Value Type Description
entities Array of Entity definition
enums Array of Enum definition
externalEnums Array of Enum definition Note: external enums are exactly the same as enums, except they
have a relPath to point to an external source file.
layers Array of Layer definition
tilesets Array of Tileset definition

2.1. Layer definition

Value Type Description
__type String Type of the layer (IntGrid, Entities, Tiles or AutoLayer)
autoRuleGroups
Only Auto-layers
Array of Object Contains all the auto-layer rule definitions.
This object contains the following fields:
  • active (Bool)
  • collapsed (Bool)
  • name (String)
  • rules (Array of Dynamic (anything))
  • uid (Int)
autoSourceLayerDefUid
Only Auto-layers
Int
autoTilesetDefUid
Only Auto-layers
Int Reference to the Tileset UID being used by this auto-layer rules
displayOpacity Float Opacity of the layer (0 to 1.0)
gridSize Int
identifier String Unique String identifier
intGridValues
Only IntGrid layer
Array of Object This object contains the following fields:
  • color (String) Hex color "#rrggbb"
  • identifier (String)
tilePivotX
Only Tile layers
Float If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell.
tilePivotY
Only Tile layers
Float If the tiles are smaller or larger than the layer grid, the pivot value will be used to position the tile relatively its grid cell.
tilesetDefUid
Only Tile layers
Int Reference to the Tileset UID being used by this tile layer
uid Int Unique Int identifier

2.2. Entity definition

Value Type Description
color String Base entity color
fieldDefs Array of Field definition Array of field definitions
height Int Pixel height
identifier String Unique String identifier
maxPerLevel Int Max instances per level
pivotX Float Pivot X coordinate (from 0 to 1.0)
pivotY Float Pivot Y coordinate (from 0 to 1.0)
tileId Int Tile ID used for optional tile display
tilesetId Int Tileset ID used for optional tile display
uid Int Unique Int identifier
width Int Pixel width

2.2.1. Field definition

Sorry this type has no documentation yet.

2.3. Tileset definition

Value Type Description
identifier String Unique String identifier
padding Int Distance in pixels from image borders
pxHei Int Image width in pixels
pxWid Int Image width in pixels
relPath String Path to the source file, relative to the current project JSON file
spacing Int Space in pixels between all tiles
tileGridSize Int
uid Int Unique Intidentifier

2.4. Enum definition

Value Type Description
externalRelPath String (can be null) Relative path to the external file providing this Enum
iconTilesetUid Int (can be null) Tileset UID if provided
identifier String Unique String identifier
uid Int Unique Int identifier
values Array of Object All possible enum values, with their optional Tile infos.
This object contains the following fields:
  • __tileSrcRect (Array of Int) Generic badge : An array of 4 Int values that refers to the tile in the tileset image: [ x, y, width, height ]
  • id (String) : Enum value
  • tileId (Int (can be null)) : The optional ID of the tile