Project 9

Iterating on Gameplay Using an Existing Game: Capture the Flag

In this project, I show you how to convert the single-player version of Capture the Flag to multiplayer. Playing Capture the Flag by yourself isn’t much fun — you need to have at least one other player. Before reading this project, complete all the code instructions from Project 8. Your code example should look like Figure 8-73. Then test all the code you wrote in Project 8.

remember Always test the code before you start making changes.

First I show you how to change the gameplay loop to include the second player and how to iterate over the code to add the second player to each function. This ensures that the second player is also getting a wand, getting respawn locations, and being able to respawn at the respawn location.


Look at the gameplay loop shown in Figure 9-1 (and defined in Project 8): It shows that you have completed all steps in the Start phase and you’re facing a new challenge — adding Player 2 to the game.

After you add a second player, you need to add a way to beat the game. In this project, I walk you through the last two iterations of the gameplay loop: adding player two and making someone ...

Get Minecraft Modding For Kids For Dummies now with the O’Reilly learning platform.

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