# How do I combine 'Or, And' event in a block ?

0 favourites
• 5 posts
From the Asset Store
Physics Block Puzzle game template for Construct 3
• I read a document here scirra.com/tutorials/292/gu ... t-features

but I don't find anything suitable for me.

I want to combine 'Or ,And' event in a block same as :

It is same as a code in java:

``````if ( (a = 1 && b = 1)|| c = 1 ){
//something
}[/code:2feo3nbf]

Thank you !``````
• The first 2 you can combine in 1... system > Is between Values.

Or you can do it all in once by using logical operatiors in an expression. As you wrote yourself.

Compare ... first value ...(a = 1 & b = 1)|c = 1.. second value ... =1

But i am not a specialist in that.

• I think you can use this system condition below and put all of your ( (a = 1 && b = 1)|| c = 1 ) into the first expression and put 1 into the second expression:

[quote:36jiy9x3]

Compare two values

Compare any two expressions (which can either numbers or text) with each other. They can be compared as Equal, Not equal, Less, Less or equal, Greater or Greater or equal.

Also, the comparison operator for AND and OR in C2 is not && and ||, but & and |.

See:

[quote:36jiy9x3]

Operators

You can use the following operators in expressions:

• (subtraction)

* (multiplication)

/ (division)

% (modulo, remainder after division)

^ (raise to power, e.g. 5 ^ 2 = 25)

& (build strings, e.g. "Your score is: " & score)

There are also comparison operators =, <>, <, <=, >, >= for comparing values. They return 1 if the comparison is true or 0 if false.

& can also be used as logical AND, and | is a logical OR operator. These are useful combined with the comparison operators, e.g. score < 0 | health < 0, which also return 1 if true and 0 if false.

?: is a conditional operator, which allows you to test conditions in expressions. This is especially useful when used with the comparison operators and logical operators. It takes the form condition ? result_if_true : result_if_false

e.g. health < 0 | score < 0 ? "Game over!" : "Keep going!".

The condition counts as true if it is non-zero, and false if it is zero.

• I just use subevents. I think that's the easy way to go, unless you're running out of events.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Yes, sub-events are the way to go. Click on any event and press "b", it'll create a sub-event.

• 5 posts