AlexHeyman / TiledReader

A simple Java library for reading Tiled files
https://www.alexheyman.org/tiledreader/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

How to use this? #11

Closed goldspark closed 2 years ago

goldspark commented 2 years ago

How do I use this? What is the main class? How to load .tmx file? How to read contents from it?

AlexHeyman commented 2 years ago

You can read Tiled files using methods of the TiledReader class, which is the main class of the library. Details can be found in the javadoc linked on the library's website, which in turn is linked in the About section of this repo. The same documentation can also be found in this repo's code files.

goldspark commented 2 years ago

Ah okay. Thank you very much, This is a very good project!

goldspark commented 2 years ago

I did TiledReader = new TiledReader and after that I did reader.getMap() and got this message: Cannot invoke "String.length()" because "spec" is nul

INFO: Beginning to parse TMX file: assets/map/game.tmx Exception in thread "main" java.lang.RuntimeException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. at org.tiledreader.TiledReader.getMap(TiledReader.java:618) at Main.main(Main.java:61)

goldspark commented 2 years ago

I got it. I had to use methods from FileSystemTiled inside overrides of TiledReader.