Overlap within overlap not working!

  • Hi,

    I am making a drag-n-drop game.

    2 targets and 2 drop objects.

    I have set 1 target sprite with 2 frames and unique id set for both. When an object is overlapped on target and has the same id then it drops on it, if not then returns to it's position.

    When the targets are not overlapping each other it works correctly. But, when 1 target is overlapping on another target in the layout then the drop function does not work in the overlapping region.

    How to solve this issue?

    nofile.io/f/Hh2EnQh6tGc/overlapproblem.c3p overlapproblem.c3p

  • [quote:2bd3vftc]When the targets are not overlapping each other it works correctly. But, when 1 target is overlapping on another target in the layout then the drop function does not work in the overlapping region.

    How to solve this issue?

    You have the Events Referencing (Sprite Vs Target) only, what you need is to create Events referencing (Target Vs Target) swell

    Will be easier if you put all the objects in a Family so you create just one Event like you did

  • [quote:q5kwupr8]When the targets are not overlapping each other it works correctly. But, when 1 target is overlapping on another target in the layout then the drop function does not work in the overlapping region.

    How to solve this issue?

    You have the Events Referencing (Sprite Vs Target) only, what you need is to create Events referencing (Target Vs Target) swell

    Will be easier if you put all the objects in a Family so you create just one Event like you did

    Thanks for the comment.

    Can you please provide a capx file?

    I've even tried family, but there too experiencing same problem!

  • [quote:1zeh2cur]

    Thanks for the comment.

    Can you please provide a capx file?

    I've even tried family, but there too experiencing same problem

    Sure, just to make sure I followed what you trying to do as is not very clear

    1-When Sprite overlaps Target and is the same Id >>> Sprite set position to the Target

    2-When Target Overlaps Target has to be the same Id or doesn't matter??

    if you can explain the steps you trying to accomplish will be easier and quicker

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • jmg89

    Here is a capx using Family

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

    you cant open it with the free version

  • [quote:3t4hdzqv]

    Thanks for the comment.

    Can you please provide a capx file?

    I've even tried family, but there too experiencing same problem

    Sure, just to make sure I followed what you trying to do as is not very clear

    1-When Sprite overlaps Target and is the same Id >>> Sprite set position to the Target

    2-When Target Overlaps Target has to be the same Id or doesn't matter??

    if you can explain the steps you trying to accomplish will be easier and quicker

    The target does not have the drag and drop function.

    Only the sprite has it.

    In the file, I provided previously when I am setting the layout where both the targets are overlapping each other then the drop function does not work. When both are placed separate then the drop works perfectly.

    Works in this setting:

    Doesn't work like this:

  • [quote:2uvyqft1]In the file, I provided previously when I am setting the layout where both the targets are overlapping each other then the drop function does not work. When both are placed separate then the drop works perfectly.

    Ok I think I get what you mean now

    So you are saying when both Targets are together and you Drag&drop an object on the targets it doesn't work right?

    That's because they are two states that are true at the same Time and therefore both of them they will fire at the same time as the object overlaps two Targets at the same time

    Object overlaps >>> Target >>> yes is true and picks Both Targets

    > object.id = Target.id >>>> is True >>>set position

    Else>>>>>>>>>>>>>>>>>> is True >>>Back to the starting Position

    The problem is here (object.id = Target.id) is not the same as (Target.id = object.id) even if they are technically the same just inverted but the results will be different, one just compares and the other one Picks

    Capx:

    https://www.dropbox.com/s/3oe5og12khuk14l/DragMatchObjects2.capx?dl=0

  • [quote:14k9fvu2]The problem is here (object.id = Target.id) is not the same as (Target.id = object.id) even if they are technically the same just inverted but the results will be different, one just compares and the other one Picks

    Capx:

    dropbox.com/s/3oe5og12khuk14l/DragMatchObjects2.capx

    Aah .. finally it's solved.

    Thanks for giving your time to help and explaining the concept.

  • [quote:1ho0bt26]Aah .. finally it's solved.

    Thanks for giving your time to help and explaining the concept

    No problem m8

  • Hey Hi! In my game i have a doubt here i am creating of two objects they are overlapping each other. How could i make that if a object comes near to the another object range. And make the object to deviate its direction from the another object? please give me a suggestion! Thank you in advance.

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