English subtitles

← Loading Tileset Data - HTML5 Game Development

Get Embed Code
5 Languages

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

  1. >> Now, the second step of parsing our map involves loading all the tileset data
  2. described in the file. For each tileset, we need to create a new image, set a
  3. call back function for once it's loaded, and then set the source value to the
  4. tilesets image attribute. This is the same basic image loading process that
  5. we've been using previously. It's worth pointing out now, that we're kicking off
  6. asynchronous loads of images for our map data, which already has been
  7. asynchronously loaded. As such, we may want to actually wait on setting the
  8. fully loaded flag to true until after all the images are loaded. To do this,
  9. you'll need to use a counter variable to keep track of how many images have been
  10. loaded, and only set the fully loaded flag to true once all the tilesets have
  11. bee successfully loaded into memory.