Adding and querying map metadata

You are now able to create, load, and render maps with Tiled and Libgdx. However, we have only been capable of showing backgrounds and little more. What about dynamic elements such as enemies, items, the player starting position, the level exit, and so on?

When designing a level, it is very typical to add special objects to represent events or dynamic entities. Once the level is loaded, the game code will have to query the map to retrieve this metadata and populate the world with the aforementioned special entities.

In this adventure around metadata land, you will learn how to add objects and set properties on them as well as load them later from a Libgdx game.

Getting ready

For this recipe, you will also need the ...

Get Libgdx Cross-platform Game Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.