I was wondering if it is possible to have such variables, used much like instance variables but for objects that don't have multiple instances (such as the mouse). From what I can find this doesn't exist which means I have to use global variables in a lot of cases. Sometimes global variables are overkill for the task at hand, which is where these sorts of variable really help.
No, i think you might have to just settle for global variables, i mean if they work than i don't think they'd put in a third option. check the manual, it would be in there if there was a third method to variables.
If you are working on a big project though, you may need a lot of variables and if they are all global like they are now surely they start to become disorganised and begin to impact workflow.
Yes that is what I am experiencing at this moment sadly.
You can create a group with a blank sub-event and add static local variables. All the appropriate code would then be in the group with access to those variables.
blackhornet Thank you, this helps a lot! However, I still think it would be better if this could be used more intuitively.
Develop games in your browser. Powerful, performant & highly capable.
plan A: Add a new event sheet, move some global vars into it, close the sheet. Now it's clean.
Plan B: use a dictionary object, put move some vars to it. Dictionary should be global by default.
jomo has a good point. I also add global sprites and use them as variable containers. The downside is you must make sure these objects exist on every layout or create them at the start of layouts you will need them on. I have an object called Global and then a bunch of instance variables on it. When I want a variable I simply say Global.whatever. Makes it easy for me.