O'Reilly logo

LibGDX Cross-Platform Development Blueprints by Indraneel Potnis

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

Chapter 8. Collectibles and Enemies

In this chapter, we will learn how to collect the items that we placed in the map. We will also see how to add hazardous locations and detect them. We will also learn how to add enemies to our game and make them move around the game world.

In this chapter, we will cover the following topics:

  • Collecting objects and detecting hazards
  • Enemies

Collecting items and detecting hazards

In this section, we will learn how to collect items in the game, such as crystals, and display scores. We will also learn how to detect hazards in the game.

Collecting objects

In this subtopic, we will learn how to collect objects such as crystals. I have made some changes to the map and it looks like the following screenshot:

The map is resized ...

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