English subtitles

← Tiled map data - HTML5 Game Development

Get Embed Code
6 Languages

Showing Revision 6 created 05/25/2016 by Udacity Robot.

  1. >> Now that we have the tiledJSON loaded, we need to parse it. So, let's take a
  2. closer look at the structure of this file. There's a few things that should
  3. interest you about this file, right away. First is the initial parameters
  4. discussing the size of the tiles that this map expects. The second, is the
  5. number of vertical and horizontal tiles used. For instance, the width parameter
  6. here defines that this map is 100 tiles wide. Of course, the total size of the
  7. map, in pixels, is width times tile width or 64 pixels per tile, given you 6400
  8. pixels. Secondly, you'll notice that there's a section devoted to what atlases
  9. this map uses, called tilesets. This section will list for each atlas, the image
  10. location, given the absolute path from the editor as well as the width and the
  11. height of the input images, any particular names or properties that you've
  12. attached to the atlas, and most importantly firstgid, which we'll get into in a
  13. minute while we're parsing our layer data. Finally, we have a separate section
  14. of the JSON file devoted to the layers that you've defined. Now, each layer that
  15. exists has a data element, which actually lists out a large, very large,
  16. ludicrously large array of integer values that represent each tile that you've
  17. placed on this layer. Of course, this layer also has other properties like the
  18. height in number of tiles, as well as the opacity, and then any other
  19. information like the name and whether or not this tile is visible. This type
  20. parameter is also interesting, because tiled allows you to have both tilelayers
  21. and object layers. Of course, this layer you're looking at is defined as a
  22. tilelayer.