How do I Stop sprites collide to each other

Get help using Construct 2

Post » Sat Dec 16, 2017 8:19 am

Hey,
As the topic says i want to stop sprite colliding each other for example sprite A is having drag and drop behaviour Horizontal and sprite B is having Vertical drag and drop so whenever i try to move them they go through each other or they move other sprites
Image
So as you can see here i don't want Sprite A to collide With Sprite B or it should stop if it collides with B and same for Sprite B
If Sprite A is having a Clear path than only it can be moved forward and same for Sprite B
Image
SOmething like this image
Please let me know if i am not able to explain myself
B
21
S
6
G
1
Posts: 17
Reputation: 1,813

Post » Sat Dec 16, 2017 8:24 am

Create a family for these objects, then make a new event. Select the family and choose "on collision with another object" For the object, choose the family. Add an action that stops movement when it collides with the other tiles. You might have to add the custom movement behavior to achieve that last part.
B
5
S
1
Posts: 4
Reputation: 337

Post » Sat Dec 16, 2017 8:25 am

Or you could apply that event to the individual sprites if you encounter other problems.
B
5
S
1
Posts: 4
Reputation: 337

Post » Sat Dec 16, 2017 9:12 am

Hey thanks for the reply I tried your way but it's not working
B
21
S
6
G
1
Posts: 17
Reputation: 1,813

Post » Sat Dec 16, 2017 10:16 am

Create an invisible sprite "A_Drag" (same size as sprite A) with Drag And Drop behavior.
Remove Drag And Drop behavior from sprite A.
So when player drags that invisible sprite A_Drag, on every tick set A position to A_Drag, but only if A_Drag is not overlapping other sprites.

I made something similar for another post:
how-do-i-successfully-make-a-slider-fx-board_p1153790?#p1153790
(see how green box can be dragged far up, but slider movement is limited by blue bar)

Here is another example:
how-do-i-make-a-pullback-mechanism_p1150905?#p1150905
Again, the green box can be dragged freely, while the car movement is restricted.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
156
Posts: 2,202
Reputation: 82,985


Return to How do I....?

Who is online

Users browsing this forum: socialpilgrim and 5 guests