Making blocks with "or" conditional

0 favourites
• 8 posts
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
• I can get construct to make conditions like this:

"if (x = 1 or y = 2 or z = 3) do things"

But I want:

if((x = 1 and y = 2) or (z = 3)) do things"

Is it possible on C2 in a way that I don't have to make messy shenanigans?

• I misread. What exactly are you hoping to do? I feel like I'm missing it.

• Try Construct 3

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

Construct 3 users don't see these ads
• Logically, your two lines are identical. There is no difference.

• I meant:

"if((x = 1 AND y = 2) or (z = 3)) do things"

on the second line, sorry (will edit post)

• You can use & and | operators to make this condition:

System-> Compare two values -> ((x = 1 & y = 2) | (z = 3)) equals 1

Of course if you need to compare things like "is overlapping" or "is mirrored", you can't use them in the formula.

In this case you might need to add a local boolean variable and do something like this:

Sprite1 overlapping A

(and) Sprite2 overalpping B -> Set tempBoolean to 1

tempBoolean=1

OR Sprite3 overlapping C -> do things

• Hey man, thanks for the response!

You can use & and | operators to make this condition:

System-> Compare two values -> ((x = 1 & y = 2) | (z = 3)) equals 1

I had already tried the "compare two values" method, but since I'm working with a "Gamepad" condition who doesn't have a expression for it, it just doesn't work.

[quote:3mx2xbof]Of course if you need to compare things like "is overlapping" or "is mirrored", you can't use them in the formula.

In this case you might need to add a local boolean variable and do something like this:

Sprite1 overlapping A

(and) Sprite2 overalpping B -> Set tempBoolean to 1

tempBoolean=1

OR Sprite3 overlapping C -> do things

I'm actually already doing that. But this method feels kinda wrong... Something so simple to implement on any script language it's a shame that we don't have a better option do deal with this situation.

Thanks again!

• Gamepad object has a few expressions, you can use them to check gamepad buttons and axes state in System-Compare values event.