Legacy GM Object Orientation in GMStudio

Zerb Games

Member
Awesome concepts! I Composition over Inheritance is something that is incredibly useful. Haven't watched the video yet, but given the description alone I think this is great!
 
X

xleonhart

Guest
Nice video.
I have something to add:
In the composition part, its valid to note that you don't need to instantiate an object to use their events. You can use event_perform_object, to perform , for example, the gun step event and this way you can have more control of where/when the gun code will be executed.
 

GMWolf

aka fel666
Nice video.
I have something to add:
In the composition part, its valid to note that you don't need to instantiate an object to use their events. You can use event_perform_object, to perform , for example, the gun step event and this way you can have more control of where/when the gun code will be executed.
That is true. Sort of using object statically. But you do loose a lot of flexibility with instance variables, and you could just assign a set of scripts.

But indeed, it is something to keep in mind when designing systems.
 
E

ECEngineering

Guest
If you want to create a lot of instances of an object this way, it is much better to deactivate them ones created as you can also access variables of the deactivated instance.
I've used "instance_create" and instance activate/deactivate functions to write "delete" and "new" scripts which can be used to do some really useful stuff like creating custom data structures.
I hope you find it useful: https://forum.yoyogames.com/index.php?threads/creating-custom-data-structures-with-simple-oop.29252/
 
Top