Skip to content

Instantly share code, notes, and snippets.

@Ne0nx3r0
Created May 20, 2017 14:13
Show Gist options
  • Save Ne0nx3r0/656a18a723ad25775dd362ac5924e85b to your computer and use it in GitHub Desktop.
Save Ne0nx3r0/656a18a723ad25775dd362ac5924e85b to your computer and use it in GitHub Desktop.
Jimp.read(asset,function(err,lenna){
if(err) throw err;
assets[assetName] = lenna;
if(Object.keys(assets).length == assetsToLoad.length){
generateMapFiles();
}
});
const image = assets[mapToProcess].clone();
image.crop(
(cropx-1)*tilewidth,
(cropy-1)*tileheight,
tilewidth*sliceSize,
tileheight*sliceSize
)
.composite(assets['hud_party'],compositeX,compositeY);
//append directions party can walk from here
if(isWalkable(x,y-1)) image.composite(assets['hud_up'],compositeX,compositeY);
if(isWalkable(x-1,y)) image.composite(assets['hud_left'],compositeX,compositeY);
if(isWalkable(x,y+1)) image.composite(assets['hud_down'],compositeX,compositeY);
if(isWalkable(x+1,y)) image.composite(assets['hud_right'],compositeX,compositeY);
image.write(subdir2+x+'-'+y+'.png');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment