Skip to content

Commit 8b4113c

Browse files
committed
Updated Asset Pack Format documentation.
1 parent 5a42a41 commit 8b4113c

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

resources/Asset Pack JSON Format/assetPack.json

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,58 @@
11
{
2-
// This is the key you use in the call to Phaser.Loader.pack
3-
// It's an Array of Loader types.
2+
// An Asset Pack is a means to control the loading of assets into Phaser via a JSON file.
3+
// Use Phaser.Loader.pack to load your data file.
44
//
5-
// Note that lots of parameters are optional.
6-
// See the API Documentation to find out which ones as they match the Loader calls exactly.
5+
// The file is split into sections. In this example they are "level1" and "level2".
6+
// Sections are a way for you to control the splitting-up of asset loading, so you don't have
7+
// to load everything at once.
8+
//
9+
// The key you use for the sections is entirely up to you and is passed to the Phaser.Loader.pack call.
10+
//
11+
// Within each section is an Array of objects. Each object corresponds to a single file to be loaded.
12+
// The "type" property controls the type of file.
13+
// Note that lots of the file properties are optional.
14+
// See the Loader API Documentation to find out which ones, as they match the API calls exactly.
15+
//
16+
// Where a file type has a callback, such as "script", the context in which the callback is run
17+
// should be passed to the Phaser.Loader.pack method. See the examples for further details.
718
"level1": [
819
{
9-
// Loads an image.
20+
// Loads an Image
1021
"type": "image",
1122
"key": "ball",
1223
"url": "assets/sprites/shinyball.png",
1324
"overwrite": false
1425
},
1526
{
27+
// Loads a Text File
1628
"type": "text",
1729
"key": "readme",
1830
"url": "assets/sprites/readme.txt",
1931
"overwrite": false
2032
},
2133
{
34+
// Loads a JSON File
2235
"type": "json",
2336
"key": "levelData",
2437
"url": "assets/level1.json",
2538
"overwrite": false
2639
},
2740
{
41+
// Loads a JavaScript File with optional callback
2842
"type": "script",
2943
"key": "webfonts",
3044
"url": "http://blah.com/font.js",
3145
"callback": "parseFontLoader"
3246
},
3347
{
48+
// Loads a Binary File with optional callback
3449
"type": "binary",
3550
"key": "data",
3651
"url": "assets/test/wibble.bmp",
3752
"callback": "parseBinary"
3853
},
3954
{
55+
// Loads a Sprite Sheet File
4056
"type": "spritesheet",
4157
"key": "webfonts",
4258
"url": "assets/sprites/mummy.png",
@@ -47,33 +63,41 @@
4763
"spacing": 0
4864
},
4965
{
66+
// Loads an Audio File
5067
"type": "audio",
5168
"key": "boden",
5269
"urls": ["assets/audio/bodenstaendig_2000_in_rock_4bit.mp3", "assets/audio/bodenstaendig_2000_in_rock_4bit.ogg"],
5370
"autoDecode": true
5471
},
5572
{
73+
// Loads a Tilemap File - in this example a CSV file.
74+
// The format matches Phaser.Tilemap consts.
5675
"type": "tilemap",
5776
"key": "level1",
5877
"url": "assets/tilemaps/level1.csv",
5978
"data": null,
6079
"format": "CSV"
6180
},
6281
{
82+
// Loads a Tilemap File - in this example a Tiled JSON file.
83+
// The format matches Phaser.Tilemap consts.
6384
"type": "tilemap",
6485
"key": "level2",
6586
"url": "assets/tilemaps/level2.json",
6687
"data": null,
6788
"format": "TILED_JSON"
6889
},
6990
{
91+
// Loads a Physics data File - in this example a Lime Corona file.
92+
// The format matches Phaser.Loader consts.
7093
"type": "physics",
7194
"key": "ship",
72-
"url": "assets/tilemaps/ship_physics.json",
95+
"url": "assets/physics/ship_physics.json",
7396
"data": null,
7497
"format": "LIME_CORONA_JSON"
7598
},
7699
{
100+
// Loads a Bitmap Font File.
77101
"type": "bitmapFont",
78102
"key": "ship",
79103
"textureURL": "assets/tilemaps/ship_physics.json",
@@ -83,27 +107,31 @@
83107
"ySpacing": 0
84108
},
85109
{
110+
// Loads a JSON Array format Texture Atlas.
86111
"type": "atlasJSONArray",
87112
"key": "map",
88113
"textureURL": "assets/sprites/map.png",
89114
"atlasURL": "assets/sprites/map.json",
90115
"atlasData": null
91116
},
92117
{
118+
// Loads a JSON Hash format Texture Atlas.
93119
"type": "atlasJSONHash",
94120
"key": "map",
95121
"textureURL": "assets/sprites/map.png",
96122
"atlasURL": "assets/sprites/map.json",
97123
"atlasData": null
98124
},
99125
{
126+
// Loads a Starling XML format Texture Atlas.
100127
"type": "atlasXML",
101128
"key": "map",
102129
"textureURL": "assets/sprites/map.png",
103130
"atlasURL": "assets/sprites/map.xml",
104131
"atlasData": null
105132
},
106133
{
134+
// Loads a Texture Atlas where you specify the format.
107135
"type": "atlas",
108136
"key": "map",
109137
"textureURL": "assets/sprites/map.png",

0 commit comments

Comments
 (0)