How to stop enemies from overlapping

Get help using Construct 2

Post » Tue Mar 11, 2014 9:18 pm

Hey,

I got a problem I can't fix and maybe someone got a solution for that.

I have a player that can walk around (orthographic = zelda like, view from top) and enemies that follow him with pathfinding. My problem is now that if you run in circles the enemies start to overlap and "merge". I want to solve it like this:

>> If enemy is overlapping enemy stop one of them for one second. <<

I don't know how to pick the two overlapping enemies out of maybe twenty others on the layout and how to then pick just one of those two so they are not being stopped forever both cause overlapping is still triggering.

Here is an capx file showing the problem: https://burpsgames.com/shared_capx/foll ... erlap.capx

Thanks for any help
Marco
B
33
S
9
G
3
Posts: 206
Reputation: 7,821

Post » Tue Mar 11, 2014 10:25 pm

You could use 'Pick Nth'. 'Pick instance 0' will pick the first instance involved in the overlapping, and 'Pick instance 1' will pick the second.

in your case:
when sprite is overlapping sprite
system --> pick Sprite instance 0
Do stuff

or however you want to accomplish your goal. But you can pick the once involved in the overlap by 'Pick Nth'
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Tue Mar 11, 2014 10:34 pm

Hey,

I didn't know that this causes just involved instances. I though it involves all instances ordered by time of creation.

I will give it a try ;)
B
33
S
9
G
3
Posts: 206
Reputation: 7,821

Post » Tue Mar 11, 2014 10:40 pm

Not as long as you use it within the overlapping as with the overlapping you have limited the amount of objects 'pick nth' will look at.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451


Return to How do I....?

Who is online

Users browsing this forum: JarkeyBacon and 4 guests