code: function draw(surface, name, x, y) {
    if (!spriteData.hasOwnProperty(name)) throw new Error("Invalid image name");
    var offsets = spriteData[name];
  //  var image = images[name]
    SDL.blitSurface(tiles, [offsets[0], offsets[1], 101, 171], surface, [x, y + (offsets[2] || 0)]);
  }
docs: var images = {}; Object.keys(spriteData).forEach(function (name) { var s = SDL.createRGBSurface(0, 101, 171); //  var s = SDL.displayFormatAlpha(s1); //  SDL.freeSurface(s1);  var offsets = spriteData[name]; SDL.blitSurface(tiles, [offsets[0], offsets[1], 101, 171], s, null); //  SDL.setColorKey(s, SDL.SURFACE.SRCCOLORKEY | SDL.SURFACE.RLEACCEL, 0); SDL.setAlpha(s, SDL.SURFACE.SRCALPHA, 255); images[name] = SDL.displayFormatAlpha(s); console.dir({s:s,image:images[name]}); SDL.freeSurface(s); }); SDL.freeSurface(tiles);