Make OR Conditional?

Get help using Construct 2

Post » Mon Dec 26, 2011 7:29 pm

When my ball hits either looseStick OR looseStick2 the same message appears, I can do this by copy/pasting the same function. It would be better and cleaner if I could simply make an OR conditional for looseStick2.

For example I can't find a way to say:
ball (On collision WITH (looseStick) OR (looseStick2)) { DO STUFF }

Screenshot:
lonrot2011-12-26 19:38:36
B
4
G
1
Posts: 53
Reputation: 708

Post » Mon Dec 26, 2011 7:39 pm

Does this Plug-In help you?

OR-Plug-In
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Mon Dec 26, 2011 7:39 pm

There is a third party plugin located at: http://www.scirra.com/forum/plugin-or_topic47046_post294591.html#294591

This will give you your OR statement
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Mon Dec 26, 2011 7:57 pm

My way would be without a Plugin

ball On collision WITH (looseStick) set variableA to x
ball On collision WITH (looseStick2) set variableA to x

variableA = x { DO STUFF }
B
21
S
5
G
5
Posts: 163
Reputation: 5,028

Post » Mon Dec 26, 2011 8:52 pm

vidi, that's not a bad idea, since I might make more than two looseSticks later on. OR only works for two objects. Thanks Weishaupt and smitchell I will try the OR plugin as well.
B
4
G
1
Posts: 53
Reputation: 708

Post » Tue Dec 27, 2011 1:08 am

vivi I have a problem with your example, if the ball collides again LooseVar won't work, or won't do anything. Is there a way to wait (allow the ball to bounce) and reset the LooseVar?

Screenshot:
lonrot2011-12-27 01:13:00
B
4
G
1
Posts: 53
Reputation: 708

Post » Tue Dec 27, 2011 2:02 am

if loseVar=0 do another stuff .eg. make it visible again and maybe set x and y to another location ...
B
21
S
5
G
5
Posts: 163
Reputation: 5,028

Post » Tue Dec 27, 2011 4:52 am

I understand now, Thanks!
B
4
G
1
Posts: 53
Reputation: 708

Post » Tue Dec 27, 2011 5:37 am

For some reason the animation for looseVar won't start, take a look.





Download Project: Lucky Hit Capxlonrot2011-12-27 05:39:07
B
4
G
1
Posts: 53
Reputation: 708

Post » Tue Dec 27, 2011 5:47 am

I think Families will help for things like this.
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests