Book Image

Mastering Android Game Development

By : Raul Portales
Book Image

Mastering Android Game Development

By: Raul Portales

Overview of this book

Table of Contents (18 chapters)
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
API Levels for Android Versions
Index

Spawning enemies – the GameController


Now we are ready to spawn some enemies. For this, we are going to introduce a new concept: the GameController.

A GameController is a special type of GameObject that has no visual representation (it is not a sprite) and its mission is to control the evolution of the game using the calls to onUpdate.

One of the most typical tasks of a GameController is managing the environment. This includes spawning enemies with the right parameters when necessary.

Game controllers fall into two main groups:

  • Procedural/random

  • Deterministic/static

Procedural/random

This is a type of GameController that generates levels or enemies based on a set of parameters (or a function) that include some sort of random input.

The main advantage of procedural generation is that you do not have to create all the levels in detail, you just provide the parameters and an algorithm. It is complicated to tune it properly, but, once it is right, it potentially presents you with a different setup...