|
1 | 1 | { |
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. |
4 | 4 | // |
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. |
7 | 18 | "level1": [ |
8 | 19 | { |
9 | | - // Loads an image. |
| 20 | + // Loads an Image |
10 | 21 | "type": "image", |
11 | 22 | "key": "ball", |
12 | 23 | "url": "assets/sprites/shinyball.png", |
13 | 24 | "overwrite": false |
14 | 25 | }, |
15 | 26 | { |
| 27 | + // Loads a Text File |
16 | 28 | "type": "text", |
17 | 29 | "key": "readme", |
18 | 30 | "url": "assets/sprites/readme.txt", |
19 | 31 | "overwrite": false |
20 | 32 | }, |
21 | 33 | { |
| 34 | + // Loads a JSON File |
22 | 35 | "type": "json", |
23 | 36 | "key": "levelData", |
24 | 37 | "url": "assets/level1.json", |
25 | 38 | "overwrite": false |
26 | 39 | }, |
27 | 40 | { |
| 41 | + // Loads a JavaScript File with optional callback |
28 | 42 | "type": "script", |
29 | 43 | "key": "webfonts", |
30 | 44 | "url": "http://blah.com/font.js", |
31 | 45 | "callback": "parseFontLoader" |
32 | 46 | }, |
33 | 47 | { |
| 48 | + // Loads a Binary File with optional callback |
34 | 49 | "type": "binary", |
35 | 50 | "key": "data", |
36 | 51 | "url": "assets/test/wibble.bmp", |
37 | 52 | "callback": "parseBinary" |
38 | 53 | }, |
39 | 54 | { |
| 55 | + // Loads a Sprite Sheet File |
40 | 56 | "type": "spritesheet", |
41 | 57 | "key": "webfonts", |
42 | 58 | "url": "assets/sprites/mummy.png", |
|
47 | 63 | "spacing": 0 |
48 | 64 | }, |
49 | 65 | { |
| 66 | + // Loads an Audio File |
50 | 67 | "type": "audio", |
51 | 68 | "key": "boden", |
52 | 69 | "urls": ["assets/audio/bodenstaendig_2000_in_rock_4bit.mp3", "assets/audio/bodenstaendig_2000_in_rock_4bit.ogg"], |
53 | 70 | "autoDecode": true |
54 | 71 | }, |
55 | 72 | { |
| 73 | + // Loads a Tilemap File - in this example a CSV file. |
| 74 | + // The format matches Phaser.Tilemap consts. |
56 | 75 | "type": "tilemap", |
57 | 76 | "key": "level1", |
58 | 77 | "url": "assets/tilemaps/level1.csv", |
59 | 78 | "data": null, |
60 | 79 | "format": "CSV" |
61 | 80 | }, |
62 | 81 | { |
| 82 | + // Loads a Tilemap File - in this example a Tiled JSON file. |
| 83 | + // The format matches Phaser.Tilemap consts. |
63 | 84 | "type": "tilemap", |
64 | 85 | "key": "level2", |
65 | 86 | "url": "assets/tilemaps/level2.json", |
66 | 87 | "data": null, |
67 | 88 | "format": "TILED_JSON" |
68 | 89 | }, |
69 | 90 | { |
| 91 | + // Loads a Physics data File - in this example a Lime Corona file. |
| 92 | + // The format matches Phaser.Loader consts. |
70 | 93 | "type": "physics", |
71 | 94 | "key": "ship", |
72 | | - "url": "assets/tilemaps/ship_physics.json", |
| 95 | + "url": "assets/physics/ship_physics.json", |
73 | 96 | "data": null, |
74 | 97 | "format": "LIME_CORONA_JSON" |
75 | 98 | }, |
76 | 99 | { |
| 100 | + // Loads a Bitmap Font File. |
77 | 101 | "type": "bitmapFont", |
78 | 102 | "key": "ship", |
79 | 103 | "textureURL": "assets/tilemaps/ship_physics.json", |
|
83 | 107 | "ySpacing": 0 |
84 | 108 | }, |
85 | 109 | { |
| 110 | + // Loads a JSON Array format Texture Atlas. |
86 | 111 | "type": "atlasJSONArray", |
87 | 112 | "key": "map", |
88 | 113 | "textureURL": "assets/sprites/map.png", |
89 | 114 | "atlasURL": "assets/sprites/map.json", |
90 | 115 | "atlasData": null |
91 | 116 | }, |
92 | 117 | { |
| 118 | + // Loads a JSON Hash format Texture Atlas. |
93 | 119 | "type": "atlasJSONHash", |
94 | 120 | "key": "map", |
95 | 121 | "textureURL": "assets/sprites/map.png", |
96 | 122 | "atlasURL": "assets/sprites/map.json", |
97 | 123 | "atlasData": null |
98 | 124 | }, |
99 | 125 | { |
| 126 | + // Loads a Starling XML format Texture Atlas. |
100 | 127 | "type": "atlasXML", |
101 | 128 | "key": "map", |
102 | 129 | "textureURL": "assets/sprites/map.png", |
103 | 130 | "atlasURL": "assets/sprites/map.xml", |
104 | 131 | "atlasData": null |
105 | 132 | }, |
106 | 133 | { |
| 134 | + // Loads a Texture Atlas where you specify the format. |
107 | 135 | "type": "atlas", |
108 | 136 | "key": "map", |
109 | 137 | "textureURL": "assets/sprites/map.png", |
|
0 commit comments