O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding Arrays

One large problem in programming is the creation of a large number of variables. Think about how long it would take to create 10 variables of the same type right now. It might look something like this:

variable 0 = 314
variable 1 = 314
variable 2 = 314
variable 3 = 314
variable 4 = 314
variable 5 = 314
variable 6 = 314
variable 7 = 314
variable 8 = 314
variable 9 = 314

Seems like a waste of time, huh? But imagine if you had to create a thousand variables. That might take forever!

As you might have guessed, Blitz3D has a way to remedy this problem. The solution is to use a feature called an array. Arrays are basically sets of variables with almost the same name. An array looks like any other variable, except it appends a subscript ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required