mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 14:08:28 +00:00
Updated Asset Pack Format documentation.
This commit is contained in:
parent
5a42a41608
commit
8b4113c245
1 changed files with 34 additions and 6 deletions
|
@ -1,42 +1,58 @@
|
|||
{
|
||||
// This is the key you use in the call to Phaser.Loader.pack
|
||||
// It's an Array of Loader types.
|
||||
// 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.
|
||||
//
|
||||
// Note that lots of parameters are optional.
|
||||
// See the API Documentation to find out which ones as they match the Loader calls exactly.
|
||||
// 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.
|
||||
"level1": [
|
||||
{
|
||||
// Loads an image.
|
||||
// Loads an Image
|
||||
"type": "image",
|
||||
"key": "ball",
|
||||
"url": "assets/sprites/shinyball.png",
|
||||
"overwrite": false
|
||||
},
|
||||
{
|
||||
// Loads a Text File
|
||||
"type": "text",
|
||||
"key": "readme",
|
||||
"url": "assets/sprites/readme.txt",
|
||||
"overwrite": false
|
||||
},
|
||||
{
|
||||
// Loads a JSON File
|
||||
"type": "json",
|
||||
"key": "levelData",
|
||||
"url": "assets/level1.json",
|
||||
"overwrite": false
|
||||
},
|
||||
{
|
||||
// Loads a JavaScript File with optional callback
|
||||
"type": "script",
|
||||
"key": "webfonts",
|
||||
"url": "http://blah.com/font.js",
|
||||
"callback": "parseFontLoader"
|
||||
},
|
||||
{
|
||||
// Loads a Binary File with optional callback
|
||||
"type": "binary",
|
||||
"key": "data",
|
||||
"url": "assets/test/wibble.bmp",
|
||||
"callback": "parseBinary"
|
||||
},
|
||||
{
|
||||
// Loads a Sprite Sheet File
|
||||
"type": "spritesheet",
|
||||
"key": "webfonts",
|
||||
"url": "assets/sprites/mummy.png",
|
||||
|
@ -47,12 +63,15 @@
|
|||
"spacing": 0
|
||||
},
|
||||
{
|
||||
// Loads an Audio File
|
||||
"type": "audio",
|
||||
"key": "boden",
|
||||
"urls": ["assets/audio/bodenstaendig_2000_in_rock_4bit.mp3", "assets/audio/bodenstaendig_2000_in_rock_4bit.ogg"],
|
||||
"autoDecode": true
|
||||
},
|
||||
{
|
||||
// Loads a Tilemap File - in this example a CSV file.
|
||||
// The format matches Phaser.Tilemap consts.
|
||||
"type": "tilemap",
|
||||
"key": "level1",
|
||||
"url": "assets/tilemaps/level1.csv",
|
||||
|
@ -60,6 +79,8 @@
|
|||
"format": "CSV"
|
||||
},
|
||||
{
|
||||
// Loads a Tilemap File - in this example a Tiled JSON file.
|
||||
// The format matches Phaser.Tilemap consts.
|
||||
"type": "tilemap",
|
||||
"key": "level2",
|
||||
"url": "assets/tilemaps/level2.json",
|
||||
|
@ -67,13 +88,16 @@
|
|||
"format": "TILED_JSON"
|
||||
},
|
||||
{
|
||||
// Loads a Physics data File - in this example a Lime Corona file.
|
||||
// The format matches Phaser.Loader consts.
|
||||
"type": "physics",
|
||||
"key": "ship",
|
||||
"url": "assets/tilemaps/ship_physics.json",
|
||||
"url": "assets/physics/ship_physics.json",
|
||||
"data": null,
|
||||
"format": "LIME_CORONA_JSON"
|
||||
},
|
||||
{
|
||||
// Loads a Bitmap Font File.
|
||||
"type": "bitmapFont",
|
||||
"key": "ship",
|
||||
"textureURL": "assets/tilemaps/ship_physics.json",
|
||||
|
@ -83,6 +107,7 @@
|
|||
"ySpacing": 0
|
||||
},
|
||||
{
|
||||
// Loads a JSON Array format Texture Atlas.
|
||||
"type": "atlasJSONArray",
|
||||
"key": "map",
|
||||
"textureURL": "assets/sprites/map.png",
|
||||
|
@ -90,6 +115,7 @@
|
|||
"atlasData": null
|
||||
},
|
||||
{
|
||||
// Loads a JSON Hash format Texture Atlas.
|
||||
"type": "atlasJSONHash",
|
||||
"key": "map",
|
||||
"textureURL": "assets/sprites/map.png",
|
||||
|
@ -97,6 +123,7 @@
|
|||
"atlasData": null
|
||||
},
|
||||
{
|
||||
// Loads a Starling XML format Texture Atlas.
|
||||
"type": "atlasXML",
|
||||
"key": "map",
|
||||
"textureURL": "assets/sprites/map.png",
|
||||
|
@ -104,6 +131,7 @@
|
|||
"atlasData": null
|
||||
},
|
||||
{
|
||||
// Loads a Texture Atlas where you specify the format.
|
||||
"type": "atlas",
|
||||
"key": "map",
|
||||
"textureURL": "assets/sprites/map.png",
|
||||
|
|
Loading…
Add table
Reference in a new issue