[Solved] Enemies behave in the same way

Hello! (im using google translate)
I’ve been using Gdevelop for a short time and I’m sure there are a lot of errors in this events. :upside_down_face:

I made 2 “box”
1 “if players is in collision to box1 move the enemy to player”
2 “if players in in collision to box2 start shooting”

It works ok with a single enemy but if I add different enemys they all behave the same way.
How do I make the enemy behave in “is own mind”?

I made a video so it’s easier to understand the problem.

Is “Repeat for each istance” the main problem?

Thanks

You haven’t shown all your events, so it’s hard to tell.

But, some things to note :

Firstly, this event will action for all Soldato objects. You haven’t taken into account the Soldato object linked to the occhio object :


Secondly, the first event here :

can be rewritten as:

image

Because there is only one Sparoadx linked to a Soldato, so there is no need to repeat over all the Soldato objects.


Thirdly, you have a lot of repeat for each Soldato, which is inefficient. Watch the start of this video on how to reduce these.

1 Like

Hey many thanks! :heart:
The “linked” part fixed it.