Why there is no hierarchy in construct2? It exist in almost every game engine i had being (starting in DIV GameStudio, father of game engines...).
i mean, Why i can't point to my son? If i spawn an object, whatever it is (even if it is not in my "family" or "container") it becomes my son, so i should be able to point it. I know, i can do this by creating an instance variable and give to each spawned object the same "variable", but it doesn't work backwards, since maybe, i want my son to point to father or his father (his grandfather) that shouldn't have the same variable.
[quote:1rh8dw6c]
In variables, is like creating a new empty array attached to every object, that array will save only the ID of their sons and each son will save his father and his own sons. Now if i want to know who's my brother, i go to my fathers array and check for his sons, also i can know who's my uncle by going to my fathers father and check his sons, etc...
Family hierarchy is important for strategy games and also improves coding and memory a lot. Is good to create smart IAs or beautiful fractal effects (like the rain of variety of bullets and ships in a space shooting game).
The main magnificent reason is that i will be able to make one object spawn his same object or thousand diferent objects, and will be easy to diference between who's spawining who, also it's easy to diference between colliding with my father or brothers if they spawn at the same tick.
Let's think an example: Ogre spawn 5 ogres, those ogres spawn 2 ogres, and i don't want the grandsons to be further than X distance from his grandfather, but i want their fathers to be more free, also the grandfathers will move to his sons. At the same time, the 5 grandfathers are not related so they will fight each other but will not harm their own family and will not damage grandsons of anybody, but the grandsons may hurt their own brothers but not their fathers.
Now this could be easly implemented with only 1 Object called Ogre, and a few lines of code if there is that hierarchy.
Other example: i have 10 different bullets, i spawn 10 bullets of the same type, but i want those bullets to be destroy by bullets if they collide, so if i only check if i collide with bullets that are not my brothers (regardless what object it is, so i can spawn endless different objects that are bullets and avoid their self destruction). Also those bullets will be able to diference between my father and grandfather (for example a ship that shots a bullet that is diveded in more bullets and those bullets creating explosions, so that explosion can damage his own grandfather, but not his father or brothers)