|
Post by Elmigo on Sept 28, 2017 11:02:55 GMT
I want pause the game, i need global variable to check it at the callbacks of entities
how i can define it?
|
|
|
Post by Admin on Sept 28, 2017 12:57:33 GMT
Anything declared outside of functions is considered global.
void main() { LoadScene("empty", "", "myMainLoop"); }
string GAME_PAUSED = "false"; // Global Variable
void myMainLoop() { // GAME_PAUSED = "false" :::: This would be a local variable for the function myMainLoop. while (GAME_PAUSED == "false") { // Continue } }
Also, Welcome to the forum!
|
|
|
Post by Elmigo on Sept 28, 2017 14:16:37 GMT
thanks
|
|
|
Post by Admin on Sept 29, 2017 3:14:16 GMT
No problem. Another quick pointer, if you plan on using a bunch of GLOBAL variables, or even just a few, be sure to initialize them first thing in your code. If you declare them deep in your code just before a function that needs them, the scripting engine may not have them initialized yet and you may get a NULL ERROR.
|
|