Construct 2 Basics - Variables

1

Stats

3,652 visits, 5,054 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 13 Jan, 2014. Last updated 19 Feb, 2019

Variables

Summary

Variables are broken into two main categories in Construct 2: global variables and instance variables.

The main difference between these two types of variables is their scope. A global variable can be seen throughout your entire project, whereas an instance variable can only be seen within an object. This means that you can only refer to an instance variable when referring to a specific object, however a global variable is capable of being referred to on its own.

Another key difference is the creation destruction of these variables. An instance variable is created when an object is created, and is destroyed once that respective object has been destroyed. A global variable, however is created once your project/program is running, and is destroyed once it stops running.

These essential differences make it important to know when to use certain types of variables.

Additionally, in Construct 2, global variables can only be number or text values, but instance variables can be number, text, and/or boolean values.

I hope this tutorial helps! Have a great day!

Best,

      Gio
  • 0 Comments

Want to leave a comment? Login or Register an account!