Phaser. TilemapParser

new TilemapParser()

Phaser.TilemapParser parses data objects from Phaser.Loader that need more preparation before they can be inserted into a Tilemap.

Source - tilemap/TilemapParser.js, line 13

Members

<static, constant> INSERT_NULL :boolean

When scanning the Tiled map data the TilemapParser can either insert a null value (true) or a Phaser.Tile instance with an index of -1 (false, the default). Depending on your game type depends how this should be configured. If you've a large sparsely populated map and the tile data doesn't need to change then setting this value to true will help with memory consumption. However if your map is small, or you need to update the tiles (perhaps the map dynamically changes during the game) then leave the default value set.

Source - tilemap/TilemapParser.js, line 26

Methods

<static> getEmptyData() → {object}

Returns an empty map data object.

Returns:
object -

Generated map data.

Source - tilemap/TilemapParser.js, line 135

<static> parse(game, key, tileWidth, tileHeight, width, height) → {object}

Parse tilemap data from the cache and creates a Tilemap object.

Parameters:
Name Type Argument Default Description
game Phaser.Game

Game reference to the currently running game.

key string

The key of the tilemap in the Cache.

tileWidth number <optional>
32

The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

tileHeight number <optional>
32

The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

width number <optional>
10

The width of the map in tiles. If this map is created from Tiled or CSV data you don't need to specify this.

height number <optional>
10

The height of the map in tiles. If this map is created from Tiled or CSV data you don't need to specify this.

Returns:
object -

The parsed map object.

Source - tilemap/TilemapParser.js, line 28

<static> parseCSV(key, data, tileWidth, tileHeight) → {object}

Parses a CSV file into valid map data.

Parameters:
Name Type Argument Default Description
key string

The name you want to give the map data.

data string

The CSV file data.

tileWidth number <optional>
32

The pixel width of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

tileHeight number <optional>
32

The pixel height of a single map tile. If using CSV data you must specify this. Not required if using Tiled map data.

Returns:
object -

Generated map data.

Source - tilemap/TilemapParser.js, line 77

<static> parseJSON(json) → {object}

Parses a Tiled JSON file into valid map data.

Parameters:
Name Type Description
json object

The JSON map data.

Returns:
object -

Generated and parsed map data.

Source - tilemap/TilemapParser.js, line 197
Phaser Copyright © 2012-2015 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.2 on Thu Feb 18 2016 14:41:08 GMT+0000 (GMT Standard Time) using the DocStrap template.

快捷菜单

注意:只有登录才能全文翻译,每个新用户赠送300会员币。
赚取方法:文章评论+1000,分享网站截图给站长+3000,另充10元+100万会员币
支持一下记得截图给站长!

VIP限时免费阅读!登录可得1万币尽情中文阅读!


记得CTRL+D收藏!
站长微信:
支持自学php网
如有问题,记得强刷一下.

  • INSERT_NULL :boolean - 属性
  • getEmptyData() → {object} - 方法
  • parse(game, key, tileWidth, tileHeight, width, height) → {object} - 方法
  • parseCSV(key, data, tileWidth, tileHeight) → {object} - 方法
  • parseJSON(json) → {object} - 方法