[SOLVED]How do I give every instance of an object light?

Hello, I’m trying to give my projectiles some lighting to give it a more appealing asthetics, however what ends up happening is that the light only spawns from the point in where the projectiles are spawned.

The light is on the base layer, I deleted the light layer it auto creates.

Its because you are only telling to create the object and just it, you should also use an action “link two objects”, after that, you link the Light to the Bullet.

In another completely separated event, you make another Repeat for each object event-type, and insert a condition “take account linked objects”, then insert again Light and Bullet.

After that, use the action “Change the position of Light” set to Bullet.X() and Bullet.Y()

So if I link the light and the projectile I no longer need the “for every object” condition?

No, you still have to use the “repeat for each”… Linking as nothing to do with their respective position.

First your create each light and link them to their object.
Then every frame, you check each light one after the other (that “for every object”) to move it to the bullet it is linked to.


An alternative solution would be to add the “sticker” behaviour to the lights. And when they are created, you stick them to their bullet. This way, you won’t need to link them, nor to perform that “for every object” every frame.

Ok so the first suggestion doesn’t work so I tried the sticker one and it’s working but there’s another problem.


so the longer I hold down the fire button the more lights it creates on the first projectile then the second then the third, etc. I only want it to create 1 light per instance of projectile.

Have a think about what you are doing there - if the mouse is down, you are creating a new instance of the ball object. Then, and separately, you are adding a light object to every ball when the bullet is fired, just the most recently created ball.

Instead, move the Ceate object light and stick it to the ball in the first event (where you create the ball). You do not need that repeat for each object at all. Just create the ball and light, and stick the light to the ball.


It worked!
But sadly I have to manual keep clicking to reach maximum rate of fire instead of pressing down on the mouse button, but it’s fine I’ll take this.

I have 1 question though, can the “For each object” exist anywhere in the events does it have to be near the conditions it’s associated to?

Yes, because of the trigger once. That says "If the mouse button was already down, ignore this event"


It’s just an event. If you use it as a subevent, where the parents have a condition to filter the objects, then that would reduce the overall processing.

But if you leave it at the first level of events, it’ll be applied to all objects.