How do I enemies system collision in a 2D platform

Get help using Construct 2

Post » Sat Feb 13, 2016 1:22 pm

Hello everybody, I have a little question about de collision system, my game is a 2D platform with RPG elements, actually looks like this

Image

The problem is when the enemies appear and follow the player's character to attack him, they overlap with each other like this

Image

If only are a few enemies in the screen the gameplay is ok, but when I have 10 or 12 in screen and 8 of them are at the same sprite is imposible to know how many enemies are here. How I do a collision system for the enemies in a 2D platform?

Player's character and enemies have the beahivor platform.
B
20
S
3
Posts: 76
Reputation: 1,085

Post » Sat Feb 13, 2016 2:27 pm

you can give them the Solid behavior, just make sure that it is enabled when the game starts.

Right click on the sprite in the Objects window to find Behaviors and when the little window pops up click the plus sign. Solid behavior should be at the top of the list
B
7
S
1
Posts: 20
Reputation: 585

Post » Sat Feb 13, 2016 2:32 pm

Hi @Odin

You can stop the movement when the enemy collides with another one or invert the direction. You must access the image editor and define there the collision polygon and before it, create an event to check collision and add an action to stop the enemies, disabling the platform, for example.

By the way: nice graphics!

Good luck.
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Sat Feb 13, 2016 2:35 pm

HerrVonClaussen wrote:you can give them the Solid behavior, just make sure that it is enabled when the game starts.

Right click on the sprite in the Objects window to find Behaviors and when the little window pops up click the plus sign. Solid behavior should be at the top of the list


Image
For some reason if I give enemies the solid behaivor they push up the parallax, in this case the parallax have to be solid too?
B
20
S
3
Posts: 76
Reputation: 1,085

Post » Sat Feb 13, 2016 3:07 pm

RBuster wrote:Hi @Odin

You can stop the movement when the enemy collides with another one or invert the direction. You must access the image editor and define there the collision polygon and before it, create an event to check collision and add an action to stop the enemies, disabling the platform, for example.

By the way: nice graphics!

Good luck.


This is the first think I tried but when the enemies enter in collision and the event deactivated the platform behaivor I can't find a good event to reactivate platform if the collision between that enemy and other is over.

Thanks for the comment about the graphics!
B
20
S
3
Posts: 76
Reputation: 1,085

Post » Sat Feb 13, 2016 3:51 pm

Try to using the invert option (if is not overlapping) or "else", and enable platform again
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Sat Feb 13, 2016 7:09 pm

RBuster wrote:Try to using the invert option (if is not overlapping) or "else", and enable platform again

Yes but, after that how can I move again the enemies? Because If the character is in the left of screen and 2 enemies come to him but in the way they collisioned...they become 2 bricks.

After the collision between 2 enemies they still in collision forever. The condition is "not overlaping" or "is not collision" are useless in this case.
B
20
S
3
Posts: 76
Reputation: 1,085

Post » Sat Feb 13, 2016 8:23 pm

@Odin

I believe the "pick imagepoint overlapping" event is more efficient in this case.

Take look at this example: https://www.dropbox.com/s/zidho4tsdyw6m ... .capx?dl=0
B
72
S
13
G
2
Posts: 990
Reputation: 6,971

Post » Sun Feb 14, 2016 4:49 pm

RBuster wrote:@Odin

I believe the "pick imagepoint overlapping" event is more efficient in this case.

Take look at this example: https://www.dropbox.com/s/zidho4tsdyw6m ... .capx?dl=0

Can you do a fast explanation about the "teste" concept in the imagepoint.X and Y . Because I try to do the example in my game and it doesn't work, i attach a screenshot.
Image
B
20
S
3
Posts: 76
Reputation: 1,085


Return to How do I....?

Who is online

Users browsing this forum: AkbarAsgharMG, cjbruce and 6 guests