Chapter 7

Adding Basic Enemy Artificial Intelligence

The artificial intelligence (AI) of the enemy will define how the enemy attacks the player and how easy or difficult the game is for the player to win. It would be easy to create an AI that anticipates every move of the player by intercepting the listener calls from the player to touchListener. However, that would not make a fun experience for the player, and your game would not be very fulfilling. The enemies that you created in the preceding chapter need some kind of plan of attack by which to engage the player and create a satisfying gaming experience.

In this chapter, you are going to add the three distinct AIs for the three different enemy types that were discussed in Chapter 2 and created ...

Get Practical Android 4 Games Development 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.