Create an object for each object, and position each object

In my game, I have a background object. A torch to be specific. I also have a light object, which should center on the torch to add effect. The torches will be placed on moving platforms, so I want the light to move with the torches. It hasn’t gone well so far.
Does anybody know a fix to this? How do I create a light object for every torch object, and have each light position on each torch? Thanks in advance.
Here is a screenshot. The code is under the BGOs comment.

Please don’t bump like that, especially after a few hours only.
Also, it’s easier to help if you explain your problem: you wrote the expected result, but you forgot the actual result.

Now, regarding your issue, for each stuff can be tricky. The position action won’t work if it’s triggered only once.
Consider using object variables to identify lights and stands and help you keep them together, and move your position action to a separate block because it always needs to be executed.

Oh, sorry about that. I didn’t realize that I forgot the actual result.
I kept bumping like that because I needed the information as soon as possible to continue development. I didn’t realize that I was being annoying. So sorry about this. :sweat:

Anyways, the expected result is that I want a light object to be created for each and every torch object, and for each light to be positioned around each individual torch so that each light moves with each torch.
The actual result kind of varies. In the screenshot’s code, the result is that a light is created for every torch, but none of them follow the torches. Without trigger once, each torch infinitely creates a ton of lights, which made the framerate take a dive. Nearly every other edit to this code will create one light for every torch, but every light is positioned around one single torch rather than one light for each torch.
How specifically do I do your suggestion with the object variables? Thanks in advance.
And also, thanks for pointing out that it’s easier to explain the situation a little more. :slight_smile:

This seems to work:

1 Like

Sorry for replying late, I didn’t have access to GDevelop for a while.
But I just tried this and it works flawlessly. Thank you very much mate. :slight_smile:

1 Like