Accessing global variables in global script
Posted: Fri Oct 01, 2010 2:50 pm
Hi!
I would like to store certain parameters in a single place so that it is easier for me to access/modify them. How can I do that?
What I have done so far:
Actor controls
Actor1
Key Down (right) > Script Editor
x += 10;
Key Down (left) > Script Editor
x -= 10;
Instead of "10" I would like to use a variable called "Speed". I declared a global variable "Speed".
In the Global Script Editor I put "Speed = 10;" and saved it as "VariableStor", but I do not know how to make GE access the Global Script ("x -= Speed" does not work)
As this did not work I created an actor called "Variables" with the condition Create Actor > Script Editor and put "Speed = 10;".
I am sure that there is a more elegant solution
Thanks in advance!
I would like to store certain parameters in a single place so that it is easier for me to access/modify them. How can I do that?
What I have done so far:
Actor controls
Actor1
Key Down (right) > Script Editor
x += 10;
Key Down (left) > Script Editor
x -= 10;
Instead of "10" I would like to use a variable called "Speed". I declared a global variable "Speed".
In the Global Script Editor I put "Speed = 10;" and saved it as "VariableStor", but I do not know how to make GE access the Global Script ("x -= Speed" does not work)
As this did not work I created an actor called "Variables" with the condition Create Actor > Script Editor and put "Speed = 10;".
I am sure that there is a more elegant solution
Thanks in advance!