Game Development Reference
In-Depth Information
Here, you can see that the dialog box is similar to the one for global variables. The only
difference is that you can now add a Boolean variable as well. For the most part, all of
these options are the same. I again highly recommend that you put a description whenever
possible.
Creating a health variable
Let's go and create a health variable and give it an Initial value of 100 in the previous
window. We can name variables whatever we want. We could even name it "banana" if we
really wanted to. Instead, we give the variables names that can help us easily understand
the data that the variable holds. By setting up the health variable, we now have a con-
tainer for the health number. This way, we can add events that add to or subtract from the
health value. We can even set up the game logic to move to a "game over" screen if the
health is below zero. Game logic is simply the logic needed to make a game. It can also
be called programming . Notice how health isn't capitalized. This is because local vari-
ables are usually not capitalized. While there is no direct rule that states this, most pro-
grammers tend to make global variables uppercase and local variables lowercase. The
reason for this is that when you look at the screen, you will know which one is a global
Search WWH ::




Custom Search