Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 Tiled editor and the following two tilesets: data/maps/tileset.png and data/maps/backgrounds.png. The data/maps/tiled.tmx map file will be needed as well. We will also use the data/maps/sprites.atlas file and the data/music/song_1.mp3 audio file.

Additionally...