How do I drag and drop properly?

0 favourites
  • 2 posts
From the Asset Store
Physics Drag & Drop
$0.50 USD
95% off
Use inertion of your movements to throw, rotate your objects and etc. Objects can interact with others while dragging.g
  • Hello everyone!

    I am getting to know Construct 2 quite well but am still having a bit of a problem. I basically have 6 objects and 6 targets. I have created a game where you have to match the correct object with the correct target. The objects all have drag and drop behaviours and I have coded everything so that it works EXCEPT ONE THING. At the moment, I am able to drag more than one object to one target. I want to make it so that only one object can be dragged to one target. How do I do this? Event sheet attached below. Would really appreciate your help, thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First read this:

    Do yourself a favor. Else you have no idea what i am rambling about.

    Secondly, dont workt that way in construct. It is not readable. Grab that line in the middle (between conditions & actions), drag it to the right, so you see more of the conditions on one line.

    Tird. Would be so much easyer if you dropped the capx.

    But ok. In event 72. You pick the object that is dropped AND all the others it is overlapping with. I have ofcourse no idea if it can overlap more then 1 object. Lets assume not. So you have now 2 objects picked. And both are instances of the same object. Thats a guess, i cant see it with every block so compressed.

    In event 73 you, with those two objects picked, you gonna filter out that list of those two objects further. You pick any of those 2 objects who's instance variable ID is same as the instance variable ID of any of those two objects. This includes the objects themself. Ofcours ID of the same object is the same. This makes both objects still picked. So, the actions run on both objects. And the instance bolean Correct of both objects get set to true.

    And this is not what you want. You read those condition wrong. I know that most programming works like IF THIS, THEN THAT. But that is not really the case in Construct.

    There are conditions that do not filter the picked (selected) objects. Like the System > Compare two values. They are of a pure if this then that type. Almost all others, and usaly you have to select an object when making that condition, DO FILTER the PREVIOUS PICKED LIST OF OBJECTS.

    I know that the manual says: actions run when the condition is true. But actions need also objects to run on. If the condition filters all objects out, the action has no objects to run on.

    Back to your problem. This is solvable. But it depends on if you have acces to families or not.

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