Book Image

Learning Construct 2

By : Aryadi Subagio
Book Image

Learning Construct 2

By: Aryadi Subagio

Overview of this book

Table of Contents (17 chapters)
Learning Construct 2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Understanding constant variables


Now, we will start changing the game state. We will do this by utilizing two kinds of variables: instance variables and global variables. We'll make several global variables that will be checked later with an instance variable. However, we will change the global variable to a special type of variable: constant variable.

Note

So, what are constant variables? They are variables, global or local, whose values do not change after they are declared. Both the text and number type variables can become constant variables. To make a constant variable, just select the Constant checkbox when creating a new global variable. Constant variables in the event sheet are indicated by their names, which appear capitalized.

Let's try it now. Go to the event sheet and create a few variables needed to create the blocks' special effect. As you remember, the default value for the blocks' effect instance variable is 0; so we'll make a value of zero when the block has no special effect...