Game Development Reference
In-Depth Information
Introducing variables
Computer programming is based on mathematical principles. After all, the first computer
was made to actually calculate equations, and it was only later that applications (as we
know them) were developed. You have probably heard of variables in science and math
classes. In computers, these variables are necessary to make applications and they are very
important in games. Even a small indie game might have hundreds of variables.
Variables are places where you can store small amounts of data. This data can be a name, a
number, a date, a game object, or it can even store true or false information. Variables are
essential to games because they can store items such as the following:
• Score
• Player name
• Game objects
• Mouse position
• Keyboard input
In order to store data, you have to store data in the right kind of variables. We can think of
variables as boxes, and what you put in these boxes depends on what type of box it is.
In most native programming languages, you have to declare a variable and its type.
Search WWH ::




Custom Search