Spawn all elements of a group with one event

  • What: I want a general way to spawn all the elements of a certain group with a single event or with a small group of events.

  • Why: to streamline the event list, to reduce the margin for error, to save time. In short, to improve Gdevelop :slight_smile:

How would you spawn multiple elements to multiple places in a single action? :thinking:
Maybe you should look into external layouts, as this allows to load multiple objects in a single event.

Never said I want to spawn multiple things in multiple locations, but here’s the conceptual solution:
For each member of Group: → Spawn Obj at Obj.Variable(PosX), Obj.Variable(PosY)
Where Obj is in each pass a different member of the group.

Another solution: I don’t know the limits the Devs have, but I guess you can also design a block that automatically lists all the members of the selected group, and offers X & Y position selection for each member, so the user can specify the position in the events instead of referencing something which is not in the events. For my use case I would prefer this solution over the first, but I see no clear advantages of one over the other.

Another solution, for my use case: I only need spawn this 50 things, because I then use 50 groups of actions to move the elements (and do other things). For me it would suffice a Spawn all the members of the group in the same place. This obviously moves the problem elsewhere in the events, but it’s a better solution than no solution.

Well, if you have so many things to spawn (why? what?), maybe you could use a single object with different animations, or you could use an external layout.

I’ll check out external layouts. (TY for the suggestion.)

On the reason I want to spawn multiple things: I’m trying to show vector graphics (a drawing) while having physics collisions (multiple sprites, one for each side of the vector polygon). Imagine the spaceship and asteroids from Asteroids: these elements have between 7 and 20 subelements (and I’m aiming for more), so the events list gets caothic quicky. Being able to say to Gdevelop When X happens → Spawn each member of Spaceship_A_Group is N times better than N events.

Click here if you want to know why I exclude making multiple sprite animations.
  • I want the shape of the ship to morph smoothly.
  • I want the asteroids to have a lot of different shapes and dimensions.
  • I want to keep the final game file size small.
  • I can’t obtain the aesthetics I want with sprites only.