M
Marcus12321
Guest
Can I place instances of objects into a room and have them be an array?
In other words, I want to place 5 objects in a room, and I want them to be obj[0], obj[1], obj[2], etc... when I am coding.
Is this possible without having to write some code? I can't change the name of an instance to obj[0], I tried.
I see that when I place an object in a room, there is a place for instance creation code, and I guess I could just have each instance assign itself to its variable in the array. But I was hoping there was a better way of doing it.
I could just have one script at startup find the instances and assign all of the instances to an array, but then you get into the whole race condition thing with which instances haven't been created yet... So the code couldn't be in a create event, it would have to be in an event that runs after all of the instances have been created.
Is there an event that runs after all of the instances have been created, like a room start event or something?
Thanks for any help. I am still wrapping my head around some of the finer details of GMS2.
In other words, I want to place 5 objects in a room, and I want them to be obj[0], obj[1], obj[2], etc... when I am coding.
Is this possible without having to write some code? I can't change the name of an instance to obj[0], I tried.
I see that when I place an object in a room, there is a place for instance creation code, and I guess I could just have each instance assign itself to its variable in the array. But I was hoping there was a better way of doing it.
I could just have one script at startup find the instances and assign all of the instances to an array, but then you get into the whole race condition thing with which instances haven't been created yet... So the code couldn't be in a create event, it would have to be in an event that runs after all of the instances have been created.
Is there an event that runs after all of the instances have been created, like a room start event or something?
Thanks for any help. I am still wrapping my head around some of the finer details of GMS2.