Do this tween for all Enemies? Help Plz


U can see i screenshot
I want all bat(enemy) to perform tween when distance is less than 270
But Only one bat work at a time (The First One But as soon he is deleted the other one actives)
I want all the bats to move who has less than 270 distance
Plz Help

Hi, you need a ‘For each’ - event block: For Each events [GDevelop wiki]

1 Like

I Have done that but that also doesnt work for me

Okay, but how did you set up your events with the “For each”-condition? It has to go to the ‘bat distance to blob’ condition.

If you check the Not a Vania example you can see how conditions and actions are applied to several instances of an enemy: GDevelop 5


Is that what u r sayin?
Its still not working

Alright, the question is now, what exactly is not working. I would suggest to test each block individually and see what works and what not.

I made a quick example. I create a random amount of “bats” and they tween to the Y position of player if the distance is less than 100 px. It works for all bats, no matter if it is just 1 or 10.


As U Can see one bat is moving while other is still at one place he is not moving
One bat is near Player while other is on top right

Is the distance of the second bat less than 270px? Maybe try to set a higher value for testing or set up a small test scene first to see if the basic event works. As mentioned the example I posted works without any problem.

When its a higher value like 800 px then it works
But i dont want it to be that higher
I think it only works when both activates at same time

‘For each’ is doing exactly what it says, it checks for each instance of bat individually whether the distance is below the given value.

For further testing you could draw a circle around your player that has a radius of 270 px and see if the bat reacts if it gets inside the circle. I would also simplify the events and start adding conditions from there (as mentioned, the example I gave works fine).

Try to replace the trigger once by a “Trigger once per instance” from this extension.

2 Likes

Ohhh Magic I used that extension and i dont know how
But it works
Well Thanks @Drona Too first i was going to use that circle
Thankss

1 Like