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

Get LibGDX Game Development By Example 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.