@excaliburjs/plugin-spritefusion
v0.30.0
Published
Excalibur Sprite Fusion Plugin
Downloads
83
Readme
Excalibur SpriteFusion Tile Map Plugin
This plugin supports the latest SpriteFusion data structure!
Sprite Fusion is a new lightweight Tilemap editor, check it out here https://www.spritefusion.com/editor
Export your map as JSON
, IMPORTANT Do not use the "save" option in the current version of the plugin.
Installation
npm install @excaliburjs/plugin-spritefusion
Create your resource, load it, then add it to your scene!
const game = new ex.Engine({...});
const spriteFusionMap = new SpriteFusionResource({
mapPath: './map/map.json',
spritesheetPath: './map/spritesheet.png'
});
const loader = new ex.Loader([spriteFusionMap]);
game.start(loader).then(() => {
spriteFusionMap.addToScene(game.currentScene);
});
Example using custom factories with tile id's.
const spriteFusionMap = new SpriteFusionResource({
mapPath: './map/map.json',
spritesheetPath: './map/spritesheet.png',
entityTileIdFactories: {
0 : (props) => {
return new ex.Actor({
pos: props.worldPos,
width: 16,
height: 16,
color: ex.Color.Red,
z: props.layer.order + 1
});
}
}
});
Specify the tile id according to this scheme, you can use this to select special tiles to run the factory.
Documentation
For more information visit https://excaliburjs.com