Chapter 10: Making Intelligent Enemies with AI
The game is coming along nicely now, but there isn't really any challenge to it yet. We collect the coins or kill our enemies, but that's all very predictable and easy.
In this chapter, we are going to change the game to make it more challenging by adding a health value to our player, George, and making the enemies chase us instead, reducing our health for each enemy that hits us. If our health gets to zero, we lose the game. So, the objective will be to collect the coins while avoiding the enemies.
To make the enemies appear more intelligent, we will use very simple Artificial Intelligence (AI) algorithms for the enemies to detect when George is nearby and, when they can see him, their movement ...
Get Building Games with Flutter 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.