# BGE: Expression to check if Collision Sensor's property is True or False

In this simple demonstration of the problem there is a blue cube. When it falls and collides with an object having the property "obstacle" (while the player is also performing some action) the cube should turn red. What kind of expression syntax can accomplish this?

If an And Controller is used instead, the cube turns red. The problem is that it will do this whether the property of the object it collides with is True or False. I want it only to happen if 'obstacle'==True. How can this be accomplished? Thanks.

## No Expression Required

I don't know if there's no way for a Collision Sensor to pass along the value of the property it's watching. Instead, we can have the object collided with send a Message, and receiving that Message can be one of the conditions required by an And Controller in order to trigger the Actuator.

Obstacle Logic

Cube Logic

As for expressions, here is a reference. I'll re-post it below:

Table 26-1. Valid expressions

Expression type  Example
===============  =======
Integer number   15
Float number     12.23224
Booleans         TRUE, FALSE
Strings          "I am a string!"
Properties       propname
Sensornames      sensorname (as named in the LogicBrick)

Table 26-2. Arithmetic expressions

Expression       Example
==========       =======
EXPR1 + EXPR2    Addition, 12+3, propname+21
EXPR1 - EXPR2    Subtraction, 12-3, propname-21
EXPR1 * EXPR2    Multiplication, 12*3, propname*21
EXPR1 / EXPR2    Division, 12/3, propname/21
EXPR1 > EXPR2    EXPR1 greater EXPR2
EXPR1 >= EXPR2   EXPR1 greater or equal EXPR2
EXPR1 < EXPR2    EXPR1 less EXPR2

Table 26-3. Boolean operations

Operation        Example
=========        =======
NOT EXPR         Not EXPR
EXPR1 OR EXPR2   logical OR
EXPR1 AND EXPR2  logical AND
EXPR1 == EXPR2   EXPR1 equals EXPR2

Conditional statement: IF( Test, ValueTrue, ValueFalse )

Examples:

Table 26-4. Expression examples

Expression           Result          Explanation
==========           ======          ===========