How to load a map in a Java program


#1

Hello,

I’m new to coding in general, and I’m searching on how to load a .tmx or .json map in Java. I’ve already did basic things with .fxml from SceneBuilder, and as I understand it there’s libraries to load .tmx in my programs. But, I don’t understand how to use the library, how to import it in eclipse (since there’s no jar).

I also read that those libraries are outdated, so, how am I supposed to load a map in a basic Java program ?

Thanks a lot in advance!


(Thorbjørn Lindeijer) #2

There’s a Java library available in the Tiled repository at https://github.com/bjorn/tiled/tree/master/util/java/libtiled-java and an example project tmxviewer-java one directory up that shows basic usage.

But indeed, this library is outdated in several areas, though some people do use it and sometimes it receives updates and fixes. If somethings doesn’t appear to work, just ask. It uses the Maven build system, but I’m very unfamiliar with the current Java ecosystem and can not help you with integrating libtiled-java into your project.