Benefit of using Tiled lib for Java?


#1

I am making a 2D platformer game using Java, which I use Tiled to make the maps for. Now, I know there is an full-blown Tiled library for Java; however, I am just using the JSON export to export my maps in JSON format and hardcoding everything (necessary) into Java. I am parsing the JSON and then using classical switch/case to place stuff based on the tile ids (which I again hardcode in).

Is this considered bad practice? Are there any benefits of using the actual full-blown Tiled lib except, of course, hard coding being hard to manage, that overcomes the nuisance of having to connect the lib to my game and having to code much anyways because my game uses individual instances of a class for each individual block, an implementation unlike (what I consider) the classical way of tile implementation (using a grid like data structure to store the tiles)?


(Thorbjørn Lindeijer) #2

Sounds like indeed there isn’t much benefit to you for using libtiled-java. It would give you the needed parsing code for loading TMX, but you’d still need to move the data from the classes used by the library into the classes you need for your game.

Btw, since Tiled can also load from JSON, you can just use JSON directly. Then there is no need for exporting.