Mool
Member
Hello guys, atm I refactor my whole game and i want to use the new 2.3 features.
Right now my code looks like this:
I have an object (singleton) which handles e.g. water (delete, spawn, draw water...)
additional I have scripts (<2.3), which are either
I want to make it cleaner, since even the private funcs are global. I read, that i could use methods that are bound to the object like:
This would help to decrease the global func amount.
Is this the way to go, or are there even better ways? My main goal is to encapsulate everthing to make future updates easier.
I am also open for additional tips, that I can use for my 2.2.5 to 2.3 refactoring.
I dont want to start with refactoring in 2 month again, because i notice there is a better way, therefore i ask. Thanks guys.
Thanks!
Right now my code looks like this:
I have an object (singleton) which handles e.g. water (delete, spawn, draw water...)
additional I have scripts (<2.3), which are either
- private __SINGLETONNAME_NAMEOFFUNC (__logic_water_draw) or
- public SINGLETONNAME_NAMEOFFUNC (logic_water_removeAll)
I want to make it cleaner, since even the private funcs are global. I read, that i could use methods that are bound to the object like:
GML:
CREATE EVENT:
water_draw = function () {...}
Is this the way to go, or are there even better ways? My main goal is to encapsulate everthing to make future updates easier.
I am also open for additional tips, that I can use for my 2.2.5 to 2.3 refactoring.
I dont want to start with refactoring in 2 month again, because i notice there is a better way, therefore i ask. Thanks guys.
Thanks!