A
AnotherDoor
Guest
Okay, I have one object with only Create and step event
(it has also speed declared in create after the "testvar = 2;")
Create event: testvar = 2;
Step event: image_angle += testvar;
"Variable not set before reading it"
I redo step event: show_message(testvar);
"2" after 5-7 times of pressing OK on the pop up it says the same error
"Variable not set before reading it"
I redo the whole thing using only global variables
Create event: global.testvar = 2;
Step event: image_angle += global.testvar;
Yayy, it works! (Also it works with the show_message when set to global)
But why only after I changed them to global ? Both of the events and their scripts are inside of the same object ? I need multiple objects with their own testvars so I can't use global. So why does not the variable work as intended?
Any help is appreciated!
(it has also speed declared in create after the "testvar = 2;")
Create event: testvar = 2;
Step event: image_angle += testvar;
"Variable not set before reading it"
I redo step event: show_message(testvar);
"2" after 5-7 times of pressing OK on the pop up it says the same error
"Variable not set before reading it"
I redo the whole thing using only global variables
Create event: global.testvar = 2;
Step event: image_angle += global.testvar;
Yayy, it works! (Also it works with the show_message when set to global)
But why only after I changed them to global ? Both of the events and their scripts are inside of the same object ? I need multiple objects with their own testvars so I can't use global. So why does not the variable work as intended?
Any help is appreciated!