[Solved] Create another instance for each instance of a group

Hi guys,

I don’t know if I made a big mistake but I don’t get why what I do doesn’t work the way I expected.

I have 47 sprite objects in a group called “food”. On the scene editor, I’ve put an instance of each on base layer, outside the screen.

What I want is, for each instance of group “food”, create another instance on layer “shop”.

But the for each instance event creates 47 times the 1st sprite object (eggs).

However I set a text object to record the names of objects the for each instance event went through…and the text is right : each object of group has been processed. However it created 47 times the 1st object in the group “food”…

I don’t get why.
I thought if I use the action"create object food" it would create the current selected object instance in the group. While this works for the “food.ObjectName()” expression, it doesn’t for “create object” action.

Did I miss something?

Hi there, not too familiar with object groups but you can try exploring what expressions are usable with object groups. Maybe there’s also food.ObjectName()? Or maybe you can use VariableString(food.ObjectName()) in the create object event.

1 Like

Don’t use create object food. Use Other Actions > Objects > Create and object from it’s name

For anyone else who is wondering where this is, click on the Add action in the event then:



@reina Thanks for your reply :))

@MrMen ah, thank you! I forgot about this action and was stuck even though I used it in the past. Solved :))

1 Like