Enemy Overlapping and Stopping

Get help using Construct 2

Post » Fri Aug 23, 2013 3:58 am

Hi all,

There's a few threads about this but I haven't yet found one that works for me. Here's what I need:

1. Enemies cannot overlap each other or the player.
2. Enemies cannot push each other or the player.
3. If two enemies collide, they can still move if the direction they are facing is clear. Otherwise, the enemy should wait.
4. One family of enemies needs to be able to walk through solid walls, like a ghost. The player and other enemies cannot walk through that wall.

My biggest problem is getting a single enemy to stop when two enemies collide. I tried to do this by giving the enemies 8Direction and Solid, but they were pushing each other, and were also clipping through walls at times. Maybe there's a way around this?

What I've settled on for now is using bullet behavior, and giving them a collision in front, where if the collision overlaps another enemy, the collision's container stops. You can see that in the example. I tried to just say "When enemy collides with enemyFamily, stop enemy", but then I can't figure out how I'd get the enemy to move again.

Does anybody have suggestions on a better way to do this?

A secondary question - if you play the capx file, you'll see the enemy jittering. I've found that if I disable the "Set desiredSpeed..." in event 5, then it stops. I have no idea why that actually helps, though. It'll possibly be a moot point if I can get the enemy movement resolved, but it's still strange.

Here's the stripped-down file as an example: https://dl.dropboxusercontent.com/u/59414921/testEnemyOverlapping.capx

Thanks in advance!
B
3
S
1
G
3
Posts: 8
Reputation: 1,066

Post » Sun Aug 25, 2013 12:59 am

@Refresh

I need that info too!

About 4., you can spawn ghosts on the top layer (above walls, players).
B
4
G
1
Posts: 14
Reputation: 658

Post » Sun Aug 25, 2013 1:48 am

Is it important for them to go in set directions? Otherwise you can make them bounce off each other, or have the system change their direction of movement every few seconds. Another way is too have a collision event to make them specificly change there angle of motion to something else if direction is important.
B
4
Posts: 5
Reputation: 262

Post » Tue Aug 27, 2013 12:56 am

Thanks for the suggestions; unfortunately I'm still looking for a solution.

[QUOTE=Kuzyn]
About 4., you can spawn ghosts on the top layer (above walls, players).[/QUOTE]
Is there a particular way to do this? I've always been under the impression that objects that interact with solids will interact with them on all layers. I tried what you suggested and confirmed that they did stop moving when hitting the walls.

And ry2009, I guess I forgot to mention in my original post that the enemies often or always chase the player, so they need to go in a specific direction and they will also often be interacting with each other. If I have them bounce or change direction it gets pretty jittery quite quickly since they tend to bunch up.
B
3
S
1
G
3
Posts: 8
Reputation: 1,066


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, plinkie, rayolf and 6 guests