Conditions are tests within your applications that trigger one or more actions. Clickteam Fusion 2.5 determines at runtime whether the condition is true or false and, if it is true, triggers the appropriate action. For example, a condition might dictate that when the user clicks a particular object with the left mouse button the application jumps to the next frame. At runtime, if the user clicks the appropriate object then the condition is true and the next frame appears. If the user does not click the appropriate object then the condition is false and the current frame remains on the screen.
- Typical conditions that your events can consist of include:
- Number of lives of Player 1 = 0
- Start of video
- Has user pressed “Enter key”?
- Is timer equal to a certain value?
- Have all soldiers been destroyed?
- Collision between rocket and meteorite
Each event in your Clickteam Fusion 2.5 applications can be made up of any number of different conditions. The order in which these conditions are tested depends on the type of condition. There are two types of conditions.
Immediate conditions
Most of the conditions in your Clickteam Fusion 2.5 application are constantly tested. But some conditions, called immediate conditions, are executed only when the originating event occurs. For example, the mouse click condition only occurs when the user clicks. These conditions can therefore be true at any moment in your application.
Here are some of the immediate conditions:
- Collisions between objects
- Collisions with the background
- An object leaves or enters the frame
- The user clicks an object, the frame, or a specific zone
- The user presses any key
- The player presses a key
- The timer reaches a specific value
Normal conditions
Normal conditions are tested for in the order in which they appear in the Event editor. For example, if you have an event with a “Start of frame” condition and a “Compare the counter to a value” condition, the actions associated with the condition that appears first in the event line will occur first.
The Normal conditions include the following:
- Comparison conditions
- Special conditions
- Object movement, animation, and direction conditions
- Sound and music conditions
- Storyboard Control object conditions
- Create New Objects object conditions
- Question & Answer object conditions
- Counter object conditions
- External conditions
Clickteam Fusion 2.5 starts at the first event and moves down through the conditions within that event. If a condition affects several objects, each object is tested in turn. When Clickteam Fusion 2.5 reaches the last event, it repeats the tests from the beginning, starting a new event cycle.
Conditions negation
You may want to create a condition that is the opposite of a condition that is available from an object’s Conditions menu. In many cases you can create such a condition by using the Negate operator to modify an existing condition. For example, if you want a condition that checks to see if the mouse pointer is not over a specific object, you can negate the condition “Check for mouse pointer over an object.” The negated condition will be true as long as the mouse is not over the selected object.
If a condition can be negated, the Negate option in the popup menu you obtain by clicking with the right mouse button on the condition is available.
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.