0 Favourites

event order - condition error

This forum is currently in read-only mode.
  • Hello all. I am new to construct and I try to figure out how it works by making some simple test programs.

    In one of these programs I try to select a box with the left click, move it on the screen with the right click.

    I have added a private variable "select" that is 1 if the box is selected and 0 if not (default is 0)

    All is fine with one box. But then I added via code another box (System:Create object Box).

    Now I select one box, (testing this using a different border), and when I right-click to move both boxes move together. The fact is that I also check for another condition (destination right click)

    Now I have noticed that when I check first the box "select" variable against 1 and then the destination it makes both boxes go there.

    But when I check the destination first then the private variable it makes the correct decision and only the selected box move to the destination... as intended.

    Now this is a huge problem. In my view the 2 ifs must give the same decision regardless of order. But it seems that is not the case.

    Please tell me what I am doing wrong or why this is happening. (I got to know the reason so I make it right in the future).

    Also, if anyone can tell me more about how you can select an object from the other similar ones using other methods than comparing a private variable. (maybe there is a better way).

    Thank you.

    (sorry for my English.. not native)

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • This method can be used for selecting one object at a time (drag and drop)

    <img src="http://dl.dropbox.com/u/22173473/follow.png" border="0" />

    Maybe you could modify it for your project?

  • Thank you!

    I was using a sub-event not 2 conditions on the same event.

    So 2 or more conditions on the same event must mens that all of these conditions must be true in order to execute the event commands?

    This opens up a lot of possibilities.

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