Creating your own Artificial Intelligence

Now, as for this game, we don't really require any A.I. since most of our obstacles themselves are a big challenge for us. However, we can have some food for thought. Here's an exercise for you. Using your knowledge gained in previous chapters, try to create an A.I. class for an enemy spawning, which will start shooting projectiles at you if it enters a certain radius. Here are your objectives for creating an A.I.:

  • Spawn enemies from right side of the screen
  • Make them move in the left-hand direction
  • Upon entering a certain radius, they will start shooting projectiles at you
  • If you collide with the projectile, the game pauses
You can use your class as a shooting projectile. You can have ...

Get Learning Android Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.