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, ...

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.