0 Favourites

How do I Stop sprites collide to each other

  • 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

    https://ibb.co/mbi29m

    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

    SOmething like this image

    Please let me know if i am not able to explain myself

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Or you could apply that event to the individual sprites if you encounter other problems.

  • Hey thanks for the reply I tried your way but it's not working

  • 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:

    (see how green box can be dragged far up, but slider movement is limited by blue bar)

    Here is another example:

    Again, the green box can be dragged freely, while the car movement is restricted.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)