How do I make an enemy collide with itself.

Get help using Construct 2

Post » Wed Apr 15, 2015 9:47 pm

Basically, I have an enemy sprite that moves to the player until they are 100 pixels away from eachother.
Image
It also has bullets, so when they are close enough, they begin to shoot at the player.

But, since I have 3 of the same enemies, they go to the player but then they eventually go inside eachother, so there's 3 enemies in one pile. The bad thing about this is that when they begin to shoot, they instead shoot 3 bullets. So if you touch that one bullet, you lose 3 health.
Here's the pic of it happening:

Image

Is there a way of making the enemies "bounce" away from eachother?
I've tried making them solid, didn't work, then giving them a physics behaviour but making them immovable. Still didn't work :/

Is there a way of colliding the enemies with themselves?
B
7
S
2
Posts: 22
Reputation: 577

Post » Thu Apr 16, 2015 12:27 am

Anything?
B
7
S
2
Posts: 22
Reputation: 577

Post » Thu Apr 16, 2015 1:25 am

System -> Pick nth Instance

If 2 instances collide, picking instance 0 will pick the first instance and instance 1 will pick the 2nd instance

ON collision Enemy with Enemy
Pick instance 0 ... do whatever
Pick instance 1 .. do whatever
B
15
S
5
G
7
Posts: 876
Reputation: 5,650

Post » Thu Apr 16, 2015 12:14 pm

procrastinator wrote:System -> Pick nth Instance

If 2 instances collide, picking instance 0 will pick the first instance and instance 1 will pick the 2nd instance

ON collision Enemy with Enemy
Pick instance 0 ... do whatever
Pick instance 1 .. do whatever


That's a start, but by colliding, I mean they can't go into eachother. Check the picture.
B
7
S
2
Posts: 22
Reputation: 577

Post » Thu Apr 16, 2015 12:26 pm

So using the above you could add actions to either one of the enemies in the collision, preventing the overlap.
sending one of them temporarily in a different direction would do the trick, or increasing/decreasing the speed of one.
It depends on what you would like to happen.
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 » Thu Apr 16, 2015 12:39 pm

LittleStain wrote:So using the above you could add actions to either one of the enemies in the collision, preventing the overlap.
sending one of them temporarily in a different direction would do the trick, or increasing/decreasing the speed of one.
It depends on what you would like to happen.


How about this:
Image
It doesn't work but I think it's a start.
B
7
S
2
Posts: 22
Reputation: 577

Post » Thu Apr 16, 2015 12:41 pm

Message: Fireche can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hey, you simply use the platform behaviour combined with a solid behaviour. Check part 4 of my videos: https://www.youtube.com/watch?v=fGGwX_grEcM
Your idea of moving them apart is a bad idea.
B
12
S
3
Posts: 211
Reputation: 1,477

Post » Thu Apr 16, 2015 12:56 pm

Message: ErvinGamez is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
Fireche wrote:Hey, you simply use the platform behaviour combined with a solid behaviour. Check part 4 of my videos: Your idea of moving them apart is a bad idea.


It *kind of* works. It's just that sometimes they teleport around for some reason.
B
7
S
2
Posts: 22
Reputation: 577

Post » Thu Apr 16, 2015 12:57 pm

There isn't an angle between corrupscepticeye and corruptscepticeye when it is the same instance.
You pick an instance in your event, so in your action both are that instance.
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 » Thu Apr 16, 2015 1:02 pm

ErvinGamez wrote:
Fireche wrote:Hey, you simply use the platform behaviour combined with a solid behaviour. Check part 4 of my videos: Your idea of moving them apart is a bad idea.


It *kind of* works. It's just that sometimes they teleport around for some reason.


Try the condition: Overlapping by offset (5,5). This might fix the teleport problem. Let me know if it did! Or disable the Platform behaviour as soon as it detects a collision. I think that's actually the better solution for what you need.
B
12
S
3
Posts: 211
Reputation: 1,477

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 22 guests