Organizing Code

A code outline for our rafting game might look something like this:

 
// DON'T TYPE THIS !!!!
 
addSunlight();
 
addScoreboard();
 
addRiver();
 
addRaft();

Do not type that in just yet—our game is going to wind up looking a little different. But you get the idea.

We’ll use a code outline like we did in Chapter 15, Project: The Purple Fruit Monster Game, and Chapter 16, Project: Tilt-a-Board, but we’ll work a little differently. Instead of writing the outline first, we’ll build the code outline at the same time that we build the functions themselves.

There is no right or wrong way to start a project—just choose what works best for you. Once you’ve built this project, you’ll have tried several different approaches in this book, ...

Get 3D Game Programming for Kids now with O’Reilly online learning.

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