Skip to main content
5 events
when toggle format what by license comment
Dec 28, 2018 at 7:18 comment added user64742 This should not be the accepted answer. instance_count() does this in one line of code.
Feb 10, 2016 at 23:24 vote accept loremIpsum1771
Feb 10, 2016 at 22:42 comment added Peter It depends how you're creating the asteroids. If you have a "Controller" object that has a line of code to create an asteroid, I would add the asteroid to the array at that same spot. If the asteroids aren't created, but instead start off in the room, then I think your only option is to use the create event in the asteroid object. As for the check, I wouldn't put it in the asteroid's step event, because then you'd have every asteroid checking the same thing (inefficiency). I would put the check in the step event of an object that there's only one of, such as the player.
Feb 10, 2016 at 22:36 comment added loremIpsum1771 Thanks for the response! Do you know where I could store this file (i.e. which event to add the script)? If it would be in the create event, would I just have code in the script to basically add the current instance to the array? I'm assuming then that the check for the array length would go in the step event for the asteroid?
Feb 10, 2016 at 22:26 history answered Peter CC BY-SA 3.0