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

Managing groups of assets for bigger games


I am pretty sure that you will find yourself an authentic master of the Libgdx AssetManager class after going over this chapter as you are now able to load and unload whatever you want, whenever you want, but wait! It means that you will have to manage all the resources that will appear in your game one by one. Definitely, masters don't like to work on repetitive tasks that can easily lead to errors.

Undoubtedly, the answer is to group assets. This is why we will tweak the default Libgdx AssetManager class a little bit in this recipe. Group organization might vary depending on the scope and type of game, so it is up to you to decide whether you will group per level, characters, menus, and so on, and what will you stream on the spot.

You can still put the icing on top of the cake by adopting a data-driven approach. It consists of describing your asset groups in an XML or JSON file in such a way as to modify your code the least possible when adding...