View Full Version : Chapter 7 Exercise 4 (or 5) - Bug Zapper Game

03-18-2010, 12:40 AM

Today I was trying to create the Big Zapper Game but I am having a very hard time trying to do this.

Exercise 4:

Create a world with a list or an array that contains bugs....When the world is played, the bugs should all move quickly in different random directions. When the user successfully clicks a big, it vanishes. The game should continue until all of the bugs are gone.

Exercise 5:

Modify the world so that at first the bugs are moving slowly. Each time the user clicks a bug, the remaining bugs should move a little faster.

What I was to do is use the function that goes something like "[right], [up], [down], [left]" for the random directions (it's in "Other" at the bottom) but I have no clue how to incorporate it in. I also am not sure how to make the bugs move faster once they are clicked on.

Any help would be greatly appreciated. Thanks in advance!

04-13-2010, 02:23 PM
Have each bug move up a random amount and move right a random amount. If the random number is negative, the fly will move down or left.

Speed it up by either multiplying the random number by more each time or decreasing the duration.

You should be able to work out the rest of it on your own.

04-13-2011, 12:29 PM
Did you ever get you big zapper game to work? If you did I would love to see how it works. I did one alos and wanted to compare games.