     tileWidth = data.tileWidth
 
     spriteLookup = {}
-    
+
     data.tileset.each (tileData, i) ->
       spriteLookup[i] = Sprite.fromURL(tileData.src)
-      
+
     loadEntities = () ->
       return unless entityCallback
 


  window.Tilemap = (name, callback, entityCallback) ->
    fromPixieId(App.Tilemaps[name], callback, entityCallback)
  
  fromPixieId = (id, callback, entityCallback) ->
    url = "http://pixie.strd6.com/s3/tilemaps/#{id}/data.json"
    
    proxy =
      draw: $.noop

    $.getJSON url, (data) ->
      $.extend(proxy, Map(data, entityCallback))
      
      callback? proxy
      
    return proxy

  window.Tilemap.fromPixieId = fromPixieId
  
  window.Tilemap.load = (options) ->
    if options.pixieId
      fromPixieId options.pixieId, options.complete, options.entity
    
)()


                x: x * tileWidth
                y: y * tileHeight
              , data.tileset[tileIndex]?.properties)

              entityCallback(entityData)

    loadEntities()      

    $.extend data,
      draw: (canvas, x, y) ->
        canvas.withTransform Matrix.translation(x, y), () ->
