Book Image

Creative Greenfoot: RAW

By : Michael Haungs
Book Image

Creative Greenfoot: RAW

By: Michael Haungs

Overview of this book

Table of Contents (17 chapters)
Creative Greenfoot
About the Author
About the Reviewers

ZombieInvasion interactive simulation

In Chapter 1, Let's Dive Right in… and Chapter 2, Animation, we went step by step in building Avoider Game and ended up with playable versions of the game by the end of each chapter. In the zombie simulation, we will watch a horde of zombies break through a wall and make their way to the homes on the other side. The user will be able to interact with the simulation by placing explosions in the simulation, that will destroy both types of zombies and the wall. For our zombie simulation, I am going to supply most of the code in the beginning, and we will concentrate our efforts on implementing collision detection. All the code supplied uses concepts and techniques we covered in the last two chapters, and it should look very familiar. We will just provide an overview discussion of the code here. Figure 1 provides a picture of our scenario.

Figure 1: Here's a screenshot of ZombieInvasion

Let's create a new scenario called ZombieInvasion and then incrementally...