 
 
   checkIfDone: =>
-    if @bodiesLoaded and @mapLoaded and (@soundsLoaded or !mediator.playWithSounds)
+    if @mapLoaded and (@soundsLoaded or !mediator.playWithSounds)
       console.log "load level completed" if debug
       @loadCompleted = true
       @_callback() if @_callback

            # done loading sounds


  loadEntitiesConfigs: =>
    if not @mapLoaded
      console.error 'Do not call loadEntities unless the map finished loading and parsing!'

    @manifest.entities.files = [] unless @manifest.entities.files?
    list = @manifest.entities.files

    for layer in @mapTiledObject.layers
      continue if layer.type is 'tilelayer'
      continue if layer.name isnt 'spawnpoints'

      for object in layer.objects
        continue if object.type is ''

        if Object.keys(object.properties).length is 0 and not mediator.ConfigurationManager[object.name]
          list.push object.name + '.json'

    @bodyCount = list.length
    for file in list
      uri = @manifest.entities.prefix + '/' + file
      console.log "Try to load #{uri}" if debug
      mediator.std.xhrGet uri, (data) =>
        try
          ent = JSON.parse data.target.responseText
          @entities[ent.tiledName] = ent
        catch e
          console.error e
          console.error "Error loading config file!"

        @bodyCount--
        if @bodyCount <= 0
          @bodiesLoaded = true
          @checkIfDone()

    if list.length is 0
      @bodiesLoaded = true

    return list


  setup: =>
    if @loadCompleted
      if not @setupped

          @mapLoaded = true
          # done parsing and rendering tiled map

          # create physics world
          @physicsManager = new PhysicsManager(@mapTiledObject)
          @physicsManager.addContactListener PostSolve: (bodyA, bodyB, impulse) ->
