Challenge 5.2: Adding Ghosts

After completing lessons 1 to 27, you are ready for your the second part of challenge 5! Add the pink, green, and blue ghosts, each with same rules as the red ghost. Here is an example.

Once you have completed the challege, play Ciccio by yourself or Heart Strung with a friend. These are both games created in one weekend during the annual Global Game Jam. After you have played, think about the potential impact games have on attitude, beliefs, values, self-esteem, health, learning, and social change.

Attempt at your own risk!

After you have all the ghosts moving about the screen, modify the code for the pink ghost to make it behave differently. Instead of randomly selecting a direction, the pink ghost should move in a direction towards Pacman whenever possible, as long as it does not cause the ghost to run into the wall or reverse direction (opposite of it's current direction).

If improving the AI for the pink ghost is not challenging enough, you could also use a nested loop to add dots in the columns and rows of the gameWindow where there is not already a wall. Here is an example with dots and a more intelligent pink ghost.

Here are some impressive submissions by previous students:

Spring 2016

Spring 2015