The question is why in the first case the object is created on mouse click, but not in the second case? “item_” doesn’t work either.
![Screenshot_8](https://forum.gdevelop.io/uploads/default/original/3X/b/f/bf141a8911626179acef2feada1bca8cdb421d75.png)
The question is why in the first case the object is created on mouse click, but not in the second case? “item_” doesn’t work either.
Because in the second example you are creating object names of “item1”, “item2” etc, which aren’t the names of objects in the group.
If you have names without sequential numbering, I suggest you put the object names into an array, and then select a random entry from the array.
Yes, I have already numbered objects before - and then everything worked. But I couldn’t understand the difference. It turns out he chooses by the number of the object. I still don’t understand arrays well, so I will do it through the numbering of the group or the animation number.
And if through an array, then what to write in action? I assigned an array in the scene variable and entered these 5 items into it.
A couple of things:
You’ll need to do something like:
Thanks for the help. Until I learn the engine and arrays better, I will use more simple options.