Add/remove object to group

I think having the ability to at runtime add or remove an object from a group would be very useful for different cases.

I’ll give some examples:

  • In a simulation game, and assigning a “Person” object a job, adding them to that group.
  • In Mario, many enemies sometimes have wings. It’d be tedious to program the same flying function for every enemy, and would just be easier to add them to a Flying group.
  • Letting the player define what behaviors a sprite has, like in Baba Is You.
  • Having something occur in a cutscene that causes all the objects to do the same thing. For example, a UFO flies over a town and causes all the buildings, trees, fences, etc to rise up. This could be done by adding all of them to a group, and just controlling that group.

These actions I believe would be super helpful to many different situations, thanks for reading! :slight_smile:


Due to the way Object Groups and object picking works, object groups don’t really exist at runtime so it is not really possible. Something similar has been discussed, custom object lists, which would be object lists where you can at runtime insert and remove instances, but I only saw the idea being quickly discussed so I wouldn’t raise my hopes up.

Though i don’t quote understand how your examples are related to object groups or need dynamic addition or removal of objects from them :sweat:

I am also a bit confused. These two items are explicitly what object groups are for in the engine already. There is no reason for them to be done at runtime. Set up your flyer object group and just add your existing flying koopas to that group, then you just target the flyer group in your events instead.

Same with your cutscene example. Just add the impacted object types to an object group and target that group as the part of the events.

There’s nothing that doing that at runtime would add as far as I can see?

Sorry for the confusion. To improve the Mario example, imagine you were playing a game with a level editor, and the player could give wings to any enemy they wanted. Without the “add to group” action, the dev would have to make a copy of every enemy and add the flying functionality in. But, if the enemy is just added to a flying group, then they will adopt the behavior, without that behavior being made for every enemy.

For the UFO example, the cutscene could feature the village, just staying on the ground not moving. Then, when the UFO goes over it, they begin to float up. While there are other ways to accomplish this, simply adding them all to a “Flying” group would be fast and intuitive.

Sorry for the confusion everyone. The examples are basically just scenarios where the player might add a behavior to an object. Adding it to the programmed group, instead of adding the same behavior to every object that the player might pick.

This is not a dispute of your feature request, this is just to add context.

For Mario Maker:

From what I understand, in Mario Maker 1, wings are a separate object, it adjusts in size (scaling) depending on what enemy/object it is attached to. The enemies themselves just have different logic if wings are applied to them (if they’re in a “flying” state, not in a flying group), and since each enemy behaves differently, adding them to a generic wings group wouldn’t simplify this, and would in fact make it harder to do the unique logic per object.