Right now GMS uses a object inherit concept instead of a components concept... this has it's advantages and disadvantages... for example:
right now as everything object is of it's kind and not a combination of components... this enables us to do:
with(object) and run through all the objects of that type... and all it's children
although imagine a structure like this
this can not be done with objects Obj_Destroyable can't have to different parents... but sometimes games need this... this is why components are a great deal:
for example:
We have various components: movable, updatable, destroyable... and each one add that property to the object
how would you go on doing something like this?!
the ideia would be to easily and rapidly reference the objects I need, not to implement a full
Entity Component System... more like an hybrid between the two.
well I could create variables:
obj_entity CREATE EVENT:
then set it to true when needed:
but if I wanted
updatable objects I would have to use
this would run though all the entities and I would be slower.
Any ideias on the matter?! Thank you in advance
right now as everything object is of it's kind and not a combination of components... this enables us to do:
with(object) and run through all the objects of that type... and all it's children
although imagine a structure like this
Code:
Obj_Entity:
Obj_Moveable
Obj_Destroyable
Obj_Static
Obj_Destroyable
for example:
We have various components: movable, updatable, destroyable... and each one add that property to the object
how would you go on doing something like this?!
the ideia would be to easily and rapidly reference the objects I need, not to implement a full
Entity Component System... more like an hybrid between the two.
well I could create variables:
obj_entity CREATE EVENT:
Code:
destroyable = false;
updatable = false;
moveable = false;
but if I wanted
updatable objects I would have to use
Code:
with(obj_entity)
{
if (updatable) {
// do stuff
}
}
Any ideias on the matter?! Thank you in advance