In a second post I was writting about creating my own level editor. A lot has happended since then (thank You reality, You’re a perfect teacher): games is being written in Java using right now and for editing levels I’m using Tiled editor

I’m very happy from that solution. Level is exported to Json.

Loading done with gson Just a few classes reflecting Json’s file structure and I was ready to go…

public class TiledMap {

	private Integer width;
	private Integer height;
	private Integer tileheight;
	private Integer tilewidth;
	private List<TiledLayer> layers;
public class TiledLayer {

	private String name;	
	private Integer height;
	List<TiledObject> objects;
public class TiledObject {

	private Integer gid;
	private String name;
	private String type;
	private Integer x;
	private Integer y;

What’s interesting: loading is done with one line!

public class MapsLoader {

	TiledMap tiledMap;

tiledMap = new Gson().fromJson(mapFileString, TiledMap.class);

… and TiledMap class is filled with a data about designed level

Project’s repository:

Tiled editor:

Level loaded in a game: