Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Construct 2

You're reading from   Learning Construct 2 Design and create your own engaging, extensible, and addictive game using Construct 2

Arrow left icon
Product type Paperback
Published in Dec 2014
Publisher
ISBN-13 9781784397678
Length 234 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Aryadi Subagio Aryadi Subagio
Author Profile Icon Aryadi Subagio
Aryadi Subagio
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image