2014-05-29 16:11:13 +00:00
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// An Asset Pack is a means to control the loading of assets into Phaser via a JSON file.
|
|
|
|
// Use Phaser.Loader.pack to load your data file.
|
2014-05-29 16:11:13 +00:00
|
|
|
//
|
2014-05-29 16:37:17 +00:00
|
|
|
// The file is split into sections. In this example they are "level1" and "level2".
|
|
|
|
// Sections are a way for you to control the splitting-up of asset loading, so you don't have
|
|
|
|
// to load everything at once.
|
|
|
|
//
|
|
|
|
// The key you use for the sections is entirely up to you and is passed to the Phaser.Loader.pack call.
|
|
|
|
//
|
|
|
|
// Within each section is an Array of objects. Each object corresponds to a single file to be loaded.
|
|
|
|
// The "type" property controls the type of file.
|
|
|
|
// Note that lots of the file properties are optional.
|
|
|
|
// See the Loader API Documentation to find out which ones, as they match the API calls exactly.
|
|
|
|
//
|
|
|
|
// Where a file type has a callback, such as "script", the context in which the callback is run
|
|
|
|
// should be passed to the Phaser.Loader.pack method. See the examples for further details.
|
2014-05-29 03:44:35 +00:00
|
|
|
"level1": [
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads an Image
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "image",
|
|
|
|
"key": "ball",
|
|
|
|
"url": "assets/sprites/shinyball.png",
|
|
|
|
"overwrite": false
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Text File
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "text",
|
|
|
|
"key": "readme",
|
|
|
|
"url": "assets/sprites/readme.txt",
|
|
|
|
"overwrite": false
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a JSON File
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "json",
|
|
|
|
"key": "levelData",
|
|
|
|
"url": "assets/level1.json",
|
|
|
|
"overwrite": false
|
|
|
|
},
|
2015-05-21 00:01:40 +00:00
|
|
|
{
|
|
|
|
// Loads a generic XML document
|
|
|
|
"type": "xml",
|
|
|
|
"key": "level-01-definitions",
|
|
|
|
"url": "assets/data/level-01-definitions.xml",
|
|
|
|
"overwrite": false
|
|
|
|
},
|
2014-05-29 03:44:35 +00:00
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a JavaScript File with optional callback
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "script",
|
|
|
|
"key": "webfonts",
|
|
|
|
"url": "http://blah.com/font.js",
|
|
|
|
"callback": "parseFontLoader"
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Binary File with optional callback
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "binary",
|
|
|
|
"key": "data",
|
|
|
|
"url": "assets/test/wibble.bmp",
|
|
|
|
"callback": "parseBinary"
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Sprite Sheet File
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "spritesheet",
|
|
|
|
"key": "webfonts",
|
|
|
|
"url": "assets/sprites/mummy.png",
|
|
|
|
"frameWidth": 32,
|
|
|
|
"frameHeight": 64,
|
|
|
|
"frameMax": 10,
|
|
|
|
"margin": 0,
|
|
|
|
"spacing": 0
|
|
|
|
},
|
2015-05-21 00:01:40 +00:00
|
|
|
{
|
|
|
|
// Loads a Video File
|
|
|
|
"type": "video",
|
|
|
|
"key": "chrome",
|
|
|
|
"urls": [ "assets/video/chrome.webm", "assets/video/chrome.m4v" ]
|
|
|
|
},
|
2014-05-29 03:44:35 +00:00
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads an Audio File
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "audio",
|
2014-05-29 14:57:01 +00:00
|
|
|
"key": "boden",
|
|
|
|
"urls": ["assets/audio/bodenstaendig_2000_in_rock_4bit.mp3", "assets/audio/bodenstaendig_2000_in_rock_4bit.ogg"],
|
2014-05-29 03:44:35 +00:00
|
|
|
"autoDecode": true
|
|
|
|
},
|
2015-05-21 00:01:40 +00:00
|
|
|
{
|
|
|
|
// Loads an Audiosprite file and its metadata
|
|
|
|
"type": "audiosprite",
|
|
|
|
"key": "dialog",
|
|
|
|
"urls": [ "assets/audiosprites/dialog.m4a", "assets/audiosprites/dialog.oga" ],
|
2015-07-27 13:13:58 +00:00
|
|
|
"jsonURL": "assets/audiosprites/dialog.json",
|
2015-05-21 00:01:40 +00:00
|
|
|
"jsonData": null,
|
|
|
|
"autoDecode": true
|
|
|
|
},
|
2014-05-29 03:44:35 +00:00
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Tilemap File - in this example a CSV file.
|
|
|
|
// The format matches Phaser.Tilemap consts.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "tilemap",
|
|
|
|
"key": "level1",
|
|
|
|
"url": "assets/tilemaps/level1.csv",
|
|
|
|
"data": null,
|
|
|
|
"format": "CSV"
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Tilemap File - in this example a Tiled JSON file.
|
|
|
|
// The format matches Phaser.Tilemap consts.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "tilemap",
|
|
|
|
"key": "level2",
|
|
|
|
"url": "assets/tilemaps/level2.json",
|
|
|
|
"data": null,
|
|
|
|
"format": "TILED_JSON"
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Physics data File - in this example a Lime Corona file.
|
|
|
|
// The format matches Phaser.Loader consts.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "physics",
|
|
|
|
"key": "ship",
|
2014-05-29 16:37:17 +00:00
|
|
|
"url": "assets/physics/ship_physics.json",
|
2014-05-29 03:44:35 +00:00
|
|
|
"data": null,
|
|
|
|
"format": "LIME_CORONA_JSON"
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Bitmap Font File.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "bitmapFont",
|
2015-05-21 00:01:40 +00:00
|
|
|
"key": "desyrel",
|
|
|
|
"textureURL": "assets/fonts/bitmapFonts/desyrel.png",
|
2015-07-27 13:13:58 +00:00
|
|
|
"atlasURL": "assets/fonts/bitmapFonts/desyrel.xml",
|
|
|
|
"atlasData": null,
|
2014-05-29 03:44:35 +00:00
|
|
|
"xSpacing": 0,
|
|
|
|
"ySpacing": 0
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a JSON Array format Texture Atlas.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "atlasJSONArray",
|
|
|
|
"key": "map",
|
|
|
|
"textureURL": "assets/sprites/map.png",
|
|
|
|
"atlasURL": "assets/sprites/map.json",
|
|
|
|
"atlasData": null
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a JSON Hash format Texture Atlas.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "atlasJSONHash",
|
|
|
|
"key": "map",
|
|
|
|
"textureURL": "assets/sprites/map.png",
|
|
|
|
"atlasURL": "assets/sprites/map.json",
|
|
|
|
"atlasData": null
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Starling XML format Texture Atlas.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "atlasXML",
|
|
|
|
"key": "map",
|
|
|
|
"textureURL": "assets/sprites/map.png",
|
|
|
|
"atlasURL": "assets/sprites/map.xml",
|
|
|
|
"atlasData": null
|
|
|
|
},
|
|
|
|
{
|
2014-05-29 16:37:17 +00:00
|
|
|
// Loads a Texture Atlas where you specify the format.
|
2014-05-29 03:44:35 +00:00
|
|
|
"type": "atlas",
|
|
|
|
"key": "map",
|
|
|
|
"textureURL": "assets/sprites/map.png",
|
|
|
|
"atlasURL": "assets/sprites/map.json",
|
|
|
|
"atlasData": null,
|
|
|
|
"format": "TEXTURE_ATLAS_JSON_ARRAY"
|
|
|
|
}
|
|
|
|
],
|
2014-05-29 16:11:13 +00:00
|
|
|
// Here's an example of another section within the Asset Pack.
|
2014-05-29 03:44:35 +00:00
|
|
|
"level2": [
|
|
|
|
{
|
|
|
|
"type": "image",
|
|
|
|
"key": "ball",
|
|
|
|
"url": "assets/sprites/shinyball.png",
|
|
|
|
"overwrite": false
|
|
|
|
}
|
2014-05-29 16:11:13 +00:00
|
|
|
],
|
|
|
|
// The meta block allows you to define data specific to the Tool / app that created this JSON file.
|
|
|
|
//
|
|
|
|
// generated: Required - String - A Unix Timestamp (or Date.now() from JS) that signifies when this JSON file was created.
|
|
|
|
// version: Required - String - Should be "1.0"
|
|
|
|
// app: Required - String containing the name of the app (or web site) that generated this JSON file.
|
|
|
|
// url: Optional - String containing the URL of the app (or web site) that generated this JSON file.
|
|
|
|
// copyright: Optional - String - A copyright notice.
|
|
|
|
//
|
|
|
|
// You can add as many extra properties as your app requires, only the above are needed / reserved as of 1.0
|
|
|
|
"meta": {
|
|
|
|
"generated": "1401380327373",
|
|
|
|
"version": "1.0",
|
|
|
|
"app": "Phaser Asset Packer",
|
|
|
|
"url": "http://phaser.io",
|
|
|
|
"copyright": "Photon Storm Ltd. 2014"
|
|
|
|
}
|
2014-05-29 03:44:35 +00:00
|
|
|
}
|