npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

phaser-tiled-json-external-loader

v0.1.1

Published

A Phaser loader for Tiled JSON tilemaps that supports external tilesets.

Downloads

14

Readme

Phaser Tiled JSON External Loader

phaser-tiled-json-external-loader is a Phaser loader that loads Tiled tilemaps exported as JSON. Unlike the built-in loader, external tilemaps are supported.

Prerequisites

  • Phaser 3.16.3 or higher (I think? I haven't tested much.)
  • Tiled 1.1.5 or higher (Again, this isn't terribly well-tested.)

Tileset Format

Only JSON-formatted tilesets are supported. TMX and other formats are not supported. Make sure to export your tilesets from Tiled as JSON files.

Relative Tileset Paths

Tilesets paths are saved by Tiled as relative to the tilemap file, and it's assumed that they are similarly relative to each other on your web server.

What this means is that your webpage should serve the tilemap and tileset files at the same paths relative to each other as when you're editing them. For example, let's say your tilemap is at /foo/tilemap.json and uses a tileset at /foo/bar/tileset.json. If your tilemap is loaded on the server at http://example.com/tilemap.json, then the tileset must be served at http://example.com/bar/tileset.json.

Installation and Setup

Via Webpack

  1. Install the library:

    npm install --save phaser-tiled-json-external-loader
  2. Import and register the loader before initializing your game:

    import registerTiledJSONExternalLoader from 'phaser-tiled-json-external-loader';
    registerTiledJSONExternalLoader(Phaser);

Via Bundled JS File

  1. Download the JS bundle from the Releases tab.

  2. Load the JS bundle in your HTML file:

    <script src="phaser-tiled-json-external-loader.js"></script>

Usage

Use the tilemapTiledJSONExternal loader to load your tilemap's JSON:

this.load.tilemapTiledJSONExternal('tilemap', 'tilemap.json');

Assuming the paths are set up correctly as described above, you should see your tilemap JSON as well as the tilesets being loaded in the network tab on your browser's devtools.

License & Copyright

Originally adapted from the Phaser built-in MutliAtlasFile loader. phaser-tiled-json-external-loader is licensed under the MIT license. See LICENSE for more info.