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
52
S
24
G
18
Posts: 295
Reputation: 13,090

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.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
26
S
8
G
4
Posts: 336
Reputation: 4,050

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
52
S
24
G
18
Posts: 295
Reputation: 13,090

Post » Fri Jul 29, 2016 6:56 am

Here it isn't work, please send a .capx.
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
26
S
8
G
4
Posts: 336
Reputation: 4,050

Post » Fri Jul 29, 2016 8:05 am

B
52
S
24
G
18
Posts: 295
Reputation: 13,090

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 =/
Liked something I say?
Tip. My Bitcoin address: 1PLaeKmXQ8vEdGGJqXMq3KyB8hxeddxeSv
B
26
S
8
G
4
Posts: 336
Reputation: 4,050

Previous

Return to How do I....?

Who is online

Users browsing this forum: jojomickymack and 53 guests