I was wondering if anyone knows of current libraries that read Tiled exported files. The only ‘recent’ one I see is openfl-tiled but that one is a few years old and still uses openfl.display.Tilesheet. I’m looking for a pure OpenFL implementation, not one in HaxeFlixel.
Looking for it for students at our faculty. Checking what advice to best give them (or attempt a very barebones implementation myself).
Thanks in advance,
It’s quite easy to accomplish.
I do have a (slightly old) version of generating a Map but requires OpenFL
3.6.1, and does not use
Tilesheet. It uses the
TilemapLayer class, which I believe to be a better approach than the current one that exists since it means fiddling about with your own layer implementation otherwise.
The example above, however, does not use the JSON file exported from Tiled. I export maps as CSV and load it in later, since I personally prefer that approach.
This class is really the bulk of the extraction from a CSV file, or multiple, into a Tilemap.
Though the implementations are more specific to the RPGFL project, you may be able to extract the code you need for your own purposes if need be.
Thanks! I will have a close look later. The essence is indeed not too complicated, I was slightly wary of all the features Tiled offers (tsx’s and what not. not really familiar enough with the tool) and the possible resulting translation to OpenFL. For now I’ll just see what I can do with the most basic setup.
You can use openfl-tiled with the CopyPixelsRenderer instead of TilesheetRenderer.
The renderer is defined in https://github.com/atomicptr/openfl-tiled/blob/dev/openfl/tiled/TiledMap.hx at fromAssets method.
Just remove the TilesheetRenderer reference (and import) and you should be ready to go.
Thanks! will have a look (thought I’d get notifications on replies)