The problem with variables in particles

I created a variable in an object, there are two such objects. The first are ghosts, they are deleted when their variable is exhausted. And a particle that should also disappear when its variable is zero. But instead, all the particles disappear.

the principle of operation for the two objects is the same, except that the particles appear on the scene, and the ghost object exists. But in theory they should have an individual variable, and it works as a result as one common to all

in general, I can’t do anything to remove the particles individually

source code https://dropmefiles.com/WknSs

Hi,
You are subtracting from the variable of all particles, so they all disappear.

Yes. But I need it not to be deleted from all variables, but only from the one that is currently touched. It works with ghosts. it is necessary that one particle associated with the bullet be removed when touching

I’ve already tried everything. It looks like this is a bug with variables.
I can’t remove particles alternately when touching.

As @Gruk wrote, you are updating the variable of all the particle emitters:

In this event, you do not have any conditions that filter or select the NewParticlesEmmiter2 to use, so the action is applied to all of them.


No you haven’t.

Gruk’s solution works. If you look at @gruks screen shot, the highlighted green lines are what you need to add to delete the particle emitter for a specific bulet object.

PE_fix

I made a new file - everything is the same. Why doesn’t it work for me?
newFile

version2-50%work

They are removed if you shooting slowly.If it’s faster, everything is the same.

Your earlier one didn’t work because you didn’t reduce the hp of the NewPparticlesEmitter2


Because there could be multiple bulet and NewSprite3 objects colliding simultaneously, you should change your events to:


In your latest one, why are you repeating for each NewParticlesEmitter, and then taking into account all NewParticlesEmitter linked to Bulet? That makes no sense. If the particle emitter you are iterating over is not linked to the Bulet object, then GDevelop won’t do anything with it.

I didn’t notice that I didn’t remove the condition for each object.I rearranged it normally and everything worked. Thanks!

I don’t quite understand , what does this connection of objects do, is there somewhere to read more about it?

Can you explain what part of my answer you are asking this about? I put up 3 screen snips, and I’m not sure which one you are referring to.

in general, what is the working principle of link

https://wiki.gdevelop.io/gdevelop5/all-features/linked-objects#link_two_objects
They are logical links, not related to position, value, or anything. Just saying: this instance here is related to that other instance.

1 Like