NSSTC / sim-ecs-tiled

Tiled map importer for sim-ecs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tiled map importer for sim-ecs

This is a helper library to import Tiled map editor JSON files into sim-ecs

Usage

Installation

$ npm install sim-ecs-tiled

Loading a map

A map can easily be loaded anytime by passing the json data as object:

const mapObject = (await fetch('/path/to/my-map.tmj')).json();

// From prep world:
prepWorld.load(await loadMap(mapObject));

// From state
class MyState extends State {
    async create(actions: ITransitionActions) {
        actions.commands.load(await loadMap(mapObject));
    }
    
    // same for other methods...
}

About

Tiled map importer for sim-ecs


Languages

Language:TypeScript 100.0%