Skip to content

excaliburjs/excalibur-spritefusion

Excalibur SpriteFusion Tile Map Plugin

This plugin supports the SpriteFusion data structure as of version 1.6.0!

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.

json-export

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);
});

Sprite Fusion Plugin

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.

tileid

entity factory

Documentation

For more information visit https://excaliburjs.com