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

Creating custom asset loaders


Other than the already mentioned default loaders for the built-in asset types in Libgdx, you can implement your own loaders for other asset types you need to manage. When beginning work on this recipe, it is a good exercise to think about what types of custom assets you might need to define.

Some games require their actors to interact with each other and the environment. They are perfect candidates to make use of physics properties and bodies.

2D/3D animations are also a good example. It is necessary to store frames, duration, and so on.

The possibilities are endless. The preceding information about physics and animation can be stored in files in such a way as to load it at runtime.

Creating custom assets might seem complex, but contrary to first impressions, it will make your code more readable as well as save you a lot of time.

In this recipe, we will focus on a 2D animation sprite loader because it will only make use of concepts that were mentioned in previous...