Home
Fusion 2.5+
Firefly+
Tutorials+
Videos+
Guides & Tips+
Extensions
Versions
Teaching


OR operators

The OR operators

A new feature has appeared in Clickteam Fusion 2.5 since build 244 : the OR operators. The OR operators can simplify a lot your program of events by allowing you to group actions on a single line of events.

The OR operator must be inserted in the group of conditions of an event, like this:

 

+ Condition 1
+ Condition 2
OR
+ Condition 3
OR
+ Condition 4
+ Condition 5

 

Upon runtime, this group of events will be true when (Condition 1 and Condition 2) is true, OR Condition 3 is true OR (Condition 4 and Condition 5) is true. If any (or several of them) of these groups of conditions is true, the actions are executed. As you can see, the OR operator allows you to group actions in one line of event instead of being obliged to duplicate them on several lines.

Two kinds of OR

Clickteam Fusion 2.5 provides two kinds of OR operators, the filtered OR and the logical OR. They work differently and you should understand them before doing complex programming. The difference lays in the way the objects are selected by the conditions.

The Filtered OR operator

This is the operator you should use in most of the cases. Imagine the following conditions and actions:

 

+ Mouse is over object 1
OR (filtered)
+ Mouse is over object 2
- Destroy object 1
- Destroy object 2

 

If the mouse is over object 1, then object 1 is destroyed, but object 2 remains there. If the mouse is over object 2, object 2 is destroyed but object 1 remains there. The filtered OR operator explores all the conditions of the event, and marks all the objects as inspected. The objects contained in false condition are marked as well, but the action related to them will not occur. This is the reason why actions in a event with the filtered OR operator will only affect the objects selected in the conditions that are true.

The Logical OR operator

This operator does not mark the objects in false conditions. As the objects are not marked, the default behavior of Clickteam Fusion 2.5 when it encounters an action dealing with non-marked objects, is to affect ALL the occurences of the given objects. In our example, if we replace the filtered OR by a logical OR, you will have as a result :
If the mouse is over object 1, then both objects are destroyed, if the object is over object 2, then both objects are destroyed. Imagine mouse is over object 1, object 1 is selected. The actions are called. The Destroy object 1 action finds a selected object (the one under the mouse) and deletes it. The Destroy object 2 action find NO selected object: it destroys all the occurences of object 2.

Using either one of the OR operator is up to you, and it depends on the program you are making.




Spread the word!



You can share this document using the following buttons.




Submit your own User Tip