# ldtk

> Importer for the LDtk project file format

Latest version **0.8.7** (published 2021-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install ldtk
pnpm add ldtk
yarn add ldtk
bun add ldtk
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.8.7 |
| Published | 2021-01-28 |
| First published | 2021-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 84.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 10 |
| Author | Jan Procházka |
| Maintainers | jprochazk |
| Keywords | ldtk, parse, parser |

## Links

- npm: https://www.npmjs.com/package/ldtk
- Repository: https://github.com/jprochazk/ldtk-ts
- Issues: https://github.com/jprochazk/ldtk-ts/issues
- npm.io page: https://npm.io/package/ldtk

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.8.7 (latest) — 2021-01-28
- 0.8.6 — 2021-01-28
- 0.8.5 — 2021-01-26
- 0.8.4 — 2021-01-26
- 0.8.3 — 2021-01-25
- 0.8.2 — 2021-01-25
- 0.8.0 — 2021-01-25
- 0.7.3 — 2021-01-24
- 0.7.2 — 2021-01-24
- 0.7.1 — 2021-01-24

## README

# ldtk-ts

[LDtk](https://ldtk.io/) 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](https://ldtk.io/files/JSON_SCHEMA.json).

Documentation is available [here](https://www.jan-prochazka.eu/ldtk-ts).

```s 
$ npm install ldtk
```

### Usage

**Basic usage**

```ts
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**

```ts
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

LDtk | ldtk-ts 
:-----:|:-------:
0.7.2 | 0.8.6
0.7.1 | 0.8.5
<0.7.0 | not supported

---
_Source: https://npm.io/package/ldtk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
