Please help me understand how to make the position of the appearance of many objects coincide and follow with every other new object? When the mouse clicks on a button in an empty space of the screen, a ball appears and StarSparks appear along with the ball (in the center of its position). The ball falls down and the StarSparks follow the ball as a whole. This works if there is only one ball. But if more balls appear, then StarSparks appear in the position of the first ball (in the screenshot this is the first ball on the left), instead of new StarSparks appear for each new ball. What is the correct way to make StarSparks appear at each new ball and follow with it as a whole?
Since your balls already get an id variable on creation, you can give your stars the same id variable too. Then put the condition
If variable id of stars = balls.variable (id)
To the event that positions your stars
You put the I’d in the wrong place.
Where you create ball & stars there you also give the stars the id of idcount, like the balls
I have tried this before. But the stars appear with each ball, but do not follow it, but remain in the place where they appear. As in the screenshot.
you need for each.
Sorry that I marked repeat in the screenshot, it is, as mentioned for each object
Thank you very much! It worked! Only when the mouse touches the ball, and then the button is released, the ball disappears, but together with one ball the stars disappear from all balls. How to make the stars disappear only for the ball that was under the mouse, and not for all balls at once?
the same way you position them.
if id of Starsparks = balls.variable(id)
you don’t need for each in this case.
It works. You helped a lot. Thank you very much!