event order - condition error

For questions about using Classic.

Post » Wed Jun 29, 2011 11:02 am

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)
B
3
G
1
Posts: 8
Reputation: 516

Post » Wed Jun 29, 2011 11:37 am

This method can be used for selecting one object at a time (drag and drop)



Maybe you could modify it for your project?
B
19
S
6
G
7
Posts: 1,204
Reputation: 7,296

Post » Wed Jun 29, 2011 12:50 pm

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.
B
3
G
1
Posts: 8
Reputation: 516


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests