Game Development Reference
In-Depth Information
Boolean variables
The last main type of variable that we need to talk about is Boolean variables . Boolean
variables are either true or false, and they are very important when it comes to games. They
are used where there can only be two options. The following are some examples of
Boolean variables:
isAlive
isShooting
isInAppPurchaseCompleted
isConnectedToInternet
Most of these variables start off with the word is . This is usually done to signify that the
variable that we are using is a Boolean. When you make games, you tend to use a lot of
Boolean variables because there are so many states that game objects can be in. Often,
these states have only two options, and the best thing to do is use a Boolean.
Sometimes, you need to use an integer instead of a Boolean. Usually, 0 equals false and 1
equals true. We will cover using these variables in Construct 2 later in the chapter.
Search WWH ::




Custom Search