Zombies Don't Overlap

Get help using Construct 2

Post » Wed Nov 25, 2015 2:30 pm

Hello,

I'm working on a zombie game. Every tick, each zombie object sets its angle towards the player and moves forward one pixel.

This is fine when there is one zombie. However, when I add multiple zombies to the layout, they all walk towards the same position. At some point, they overlap and won't separate.

How do I make it so that the zombies can't overlap?

Thanks!
B
9
S
2
Posts: 26
Reputation: 807

Post » Wed Nov 25, 2015 2:36 pm

Is there a reason why you are not using built in movement behaviours?
This would be easily solved for example by using bullet behaviour with bounce of solids and giving the zombies solid behaviour as well..

If you want to do it your way, you might want to do a distance check, or an is overlapping, or an on collision and have one of the zombies stop moving for a while (maybe looking around dazed?) or any other behaviour you'd like..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Nov 25, 2015 2:41 pm

Thanks for your quick reply. I have tried giving the zombies the bullet and solid behaviors, but that doesn't work for some reason. The zombies still overlap.

The closest thing I've come up with so far is when a collision happens, to physically move both zombies. However, that looks really weird.

You just gave me an idea...I'm about to test it out. Perhaps the zombies don't always have to be following the player...
B
9
S
2
Posts: 26
Reputation: 807

Post » Thu Nov 26, 2015 12:19 pm

Here is a way to do it, but you'll need to use families.

https://www.dropbox.com/s/0rg9bpztog6ro ... .capx?dl=0

I believe R0J0 has an example somewhere that does an amazing job on objects pushing/avoiding each other! Try searching on the forum for that, I don't remember if he is using families or not...
composer - multimedia artist
www.eli0s.com/en/
B
67
S
26
G
4
Posts: 1,145
Reputation: 9,622

Post » Thu Nov 26, 2015 5:01 pm

eli0s,

Thank you so much! I believe that example is similar to what I'm looking for.
B
9
S
2
Posts: 26
Reputation: 807

Post » Thu Nov 26, 2015 9:32 pm

@satellite23 , you are welcome! Here is R0J0's example, I had it buried somewhere on my HHD. He does use families but his example, as I said, is amazing!!!
composer - multimedia artist
www.eli0s.com/en/
B
67
S
26
G
4
Posts: 1,145
Reputation: 9,622

Post » Wed Dec 02, 2015 7:35 am

@eli0s, how about if the green comes closer and the red avoids it? how do we do that?
B
6
Posts: 43
Reputation: 342

Post » Wed Dec 02, 2015 3:43 pm

@desasteraang , this is a start but it isn't the right way to do it, because there is some flickering/shaking in the zombies that I can't get rid off... Perhaps someone can improve upon this...

https://www.dropbox.com/s/5rghb7d7y7jct ... .capx?dl=0
composer - multimedia artist
www.eli0s.com/en/
B
67
S
26
G
4
Posts: 1,145
Reputation: 9,622


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, ismael123, lennaert, mathu, Yahoo [Bot] and 6 guests