How do I pick objects by instant variable for set behavior

Get help using Construct 2

Post » Fri Jul 29, 2016 2:19 am

When I tried to recreate this I didn't need a For Each loop, each instance would enable/disable its behavior based on its individual variable. Most likely some other event is interfering and setting all of the objects variable to the same thing.

In my experiment all I did was have 3 different objects, A, X, Y, where A had drag and drop behavior and X and Y had sine behavior to make them move.

If A collides with X -> Set variable to "no"
If A collides with Y -> Set variable to "yes"
If variable = "no" -> Disabled drag and drop
If variable = "yes" -> Enable drag and drop

This worked as expected with multiple instances of A, so the issue seems to be someplace else.
B
49
S
23
G
17
Posts: 291
Reputation: 12,407

Post » Fri Jul 29, 2016 5:18 am

Sup with that? wrote:When I tried to recreate this I didn't need a For Each loop, each instance would enable/disable its behavior based on its individual variable. Most likely some other event is interfering and setting all of the objects variable to the same thing.

In my experiment all I did was have 3 different objects, A, X, Y, where A had drag and drop behavior and X and Y had sine behavior to make them move.

If A collides with X -> Set variable to "no"
If A collides with Y -> Set variable to "yes"
If variable = "no" -> Disabled drag and drop
If variable = "yes" -> Enable drag and drop

This worked as expected with multiple instances of A, so the issue seems to be someplace else.


Please attach the .capx file.
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jul 29, 2016 6:05 am

I didn't save it since I was just doodling lol

Should be really simple to recreate since it was literally those four conditions and three objects. I can try to redo it tomorrow.
B
49
S
23
G
17
Posts: 291
Reputation: 12,407

Post » Fri Jul 29, 2016 6:56 am

Here it isn't work, please send a .capx.
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Post » Fri Jul 29, 2016 8:05 am

B
49
S
23
G
17
Posts: 291
Reputation: 12,407

Post » Fri Jul 29, 2016 9:12 am

Thank you very much, here your example works, but I don't know how it applyes to my project.
I will use two instances instead of one =/
My Bitcoin address: 1NG9VKTZzA3patBrWySA4qRWcuKyYkhtfc
B
23
S
7
G
4
Posts: 320
Reputation: 3,839

Previous

Return to How do I....?

Who is online

Users browsing this forum: davidbox, Mayfly and 5 guests