Yizzard
Member
So I have this system where all items (weapons, consumables, etc.) are children of an overarching obj_Item. It's children are obj_Weapons, obj_Consumables, etc. which in turn are the parents to obj_SteelSword, obj_BucketOGoo, etc. which are actual items. I wanted to have an item bank that basically just spawned in one of each item, read from their variables then deleted all of them. I have it now just listing out like
for every single item in the game. then at the end I iterate through itemList and delete them all. I was just wondering if there was some way to spawn in every child of the obj_Item object or maybe even the obj_Weapons and obj_Consumables objects so I don't have to add an item to this bank every single time I add an item to the game. Is there some way to iterate through all children of an object and spawn each one in or something like that? I haven't seen anything like that but I very easily could have just missed it.
Thanks for any tips!
Code:
itemList[0] = instance_create_depth(x, y, 5000, obj_NoWeaponEquipped);
itemList[1] = instance_create_depth(x, y, 5000, obj_WoodenSword);
...
Thanks for any tips!