-
Notifications
You must be signed in to change notification settings - Fork 5
Level JSON file structure
ppelikan edited this page Jul 17, 2018
·
1 revision
Example of 2 layer level (with 2 different animations and 3 events) exported to JSON file:
(Actual key-value expressions may be arranged in different order than stated below, however, this does not affect data integrity, and the JSON file will always be correct.)
{
"level-name": "Level 1",
"tile-sizeX": 32,
"tile-sizeY": 32,
"animations": [
{"fps": 15, "is-ping-pong": false, "frames": [1, 2, 3, 4]},
{"fps": 5, "is-ping-pong": true, "frames": [6, 6, 10]}
],
"layers": [
{"sizeX": 8, "sizeY": 5, "tiles": [[5, 5, 5, 5, 5, 5, 5, 5], [5, -2, 6, 6, 6, 6, 6, 7], [5, 6, -1, 10, 10, -1, 6, 7], [5, 6, 6, 6, 6, 6, -2, 7], [5, 7, 7, 7, 7, 7, 7, 7]]},
{"sizeX": 8, "sizeY": 5, "tiles": [[7, 7, 7, 7, 7, 7, 7, 7], [7, 6, 6, 6, 6, 6, -2, 7], [7, 6, 5, -1, -1, 5, 6, 7], [7, -2, 6, 6, 6, 6, 6, 7], [7, 7, 7, 7, 7, 7, 7, 7]]}
],
"events": [
{"name": "Start", "parameters": "", "level-positions": [[2, 3], [3, 3], [4, 3], [5, 3]]},
{"name": "Finish", "parameters": "", "level-positions": [[2, 1], [3, 1], [4, 1], [5, 1]]},
{"name": "Enemy", "parameters": "VeryAngry", "level-positions": [[1, 2], [6, 2]]}
]
}
-
level-name
- String containing level name -
tile-sizeX
,tile-sizeY
- Tile dimensions in pixels -
animations
- List (array) of all animations-
fps
- Frames per second value -
is-ping-pong
- Boolean describint whether animation is ping-pong type -
frames
- Array containing tile indexes corresponding to each frame of animation
-
-
layers
- List (array) of all layers-
sizeX
,SizeY
- layers dimensions in tiles -
tiles
- 2D array representing indexes of tiles on each position
-
[[x0y0, x1y0, x2y0],
[x0y1, x1y1, x2y1],
[x0y2, x1y2, x2y2]]
(value < 0
corresponds to animation index, value >= 0
corresponds to tile index)
-
events
- List (array) of all events-
name
- String containing event name -
parameters
- String containing event custom parameters -
level-positions
- 2D array containing list of current event's[x,y]
positions on the map
-