0.8.7 • Published 3 years ago

ldtk v0.8.7

Weekly downloads
12
License
MIT
Repository
github
Last release
3 years ago

ldtk-ts

LDtk file format type definitions and import wrapper.

This library provides an API without all the noise of LDtk "editor-only" values, definitions, etc., combined with many utilities to make usage easier.

If you just want the type definitions, they're fully compliant with the schema.

Documentation is available here.

$ npm install ldtk

Usage

Basic usage

import { World } from "ldtk";

World.loadRaw("assets/world.ldtk").then(async world => {
    // You have access to the raw `LDtk` JSON file here
    let currentLevel = world.levels[0];
    for (const layer of currentLevel.layerInstances) {
        console.log(layer);
        // the world is your oyster
    }
})

Using the importer

import { World, LDtk } from "ldtk";

World.fromURL("assets/world.ldtk").then(async world => {
    let currentLevel = world.levelMap["Level1"];
    function loop(time) {
        render(currentLevel);

        window.requestAnimationFrame(loop);
    }
    window.requestAnimationFrame(loop)
});

Versioning table

LDtkldtk-ts
0.7.20.8.6
0.7.10.8.5
<0.7.0not supported
0.8.7

3 years ago

0.8.6

3 years ago

0.8.5

3 years ago

0.8.4

3 years ago

0.8.3

3 years ago

0.8.2

3 years ago

0.8.0

3 years ago

0.7.3

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago