code: function preloadImages(images, callback) {
  
      preloader(images, _preload, callback);
  
      function _preload(asset, doneCallback) {
          asset.img = new Image();
          asset.img.src = 'img/' + asset.path + '.png';
  
          asset.img.addEventListener("load", function () {
              doneCallback();
          }, false);
  
          asset.img.addEventListener("error", function (err) {
              doneCallback(err, asset.path);
          }, false);
      }
  }
docs: Images must be preloaded before they are used to draw into canvas