hello
I'm having a hard time trying to increment a global variable inside a script. I thought global variables could be changed anywhere, so this is pretty confusing.
example: global.heartcount++
I have a draw event in the room to represent the global.heartcount number so that I can see whether or not it's working.
the code works fine when it's directly inside an object, but doesn't seem to register when it's used in a script. here are screenshots of an example of the issue:
screenshots:
1.) script 2.) script inside object 3.) result of script inside object 4.) code directly in object 5.) result of code directly in object
I'm having a hard time trying to increment a global variable inside a script. I thought global variables could be changed anywhere, so this is pretty confusing.
example: global.heartcount++
I have a draw event in the room to represent the global.heartcount number so that I can see whether or not it's working.
the code works fine when it's directly inside an object, but doesn't seem to register when it's used in a script. here are screenshots of an example of the issue:
screenshots:
1.) script 2.) script inside object 3.) result of script inside object 4.) code directly in object 5.) result of code directly in object