What’s Next

Functions are very powerful tools for JavaScript programmers. We saw two good uses for functions. Over-and-over functions like makePlanet() save a lot of coding. Calculating values like the random r() function also helps to make our coding lives easier. We even saw that the animate() function we’ve been using everywhere is a kind of tells-a-story function. It tells the story of animation in our games.

Most importantly though, we put all of these together to build a cool little universe. And we’re still just scratching the surface!

As you’ll see shortly, we’ll use functions a lot in the upcoming chapters. Let’s get started in the next chapter as we teach our avatar how to move its hands and feet!

Get 3D Game Programming for Kids, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.