Constants

From Game Editor

Jump to: navigation, search

You can define your own constants in Game Editor. Constants a about like variables, but constants can't be changed during the game. You can put a constant's name in any scripts and they will be replaced by their value when executing the game.


How to define constants

Open the global script editor and put in #define. Leave a space and type the name of this constant. Type the value after the name within a space.

Example:

#define TRUE 1
#define FALSE 0

In this example we define two constants, TRUE and FALSE.

Example for using:

textNumber = TRUE;
myactor.textNumber = FALSE;

If you have defined these two constants before, the code above is completly the same as this:

textNumber = 1;
myactor.textNumber = 0;