O'Reilly logo

LibGDX Game Development By Example by James Cook

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding a collectable

We almost have a platforming game! Admittedly, it doesn't do much—yet! But hey, let's change that. One of the main components of a platformer is having something for the player to collect. Considering Pete is a squirrel, I guess it is only right that he collects acorns.

To add our collectable to the game, we are going to need to do a couple of things. Firstly, we need to find a way for us to place the collectables in the game in an easy-to-do manner , next, have them successfully load that information into LibGDX, and then, finally, have the interaction between Pete and the acorn.

Our acorn will look as follows:

Adding a collectable

So, what can we ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required