The Functions

Functions let you retrieve data from one object for use in another object. For example, you can retrieve the date displayed in the Date & Time object and display it in the String object. Functions can be accessed via the [Retrieve Data From An Object] button in the Clickteam Fusion 2.5 Expression editor. Each function loads a specific value into the equation displayed in the Expression editor. The Expression editor is displayed whenever Clickteam Fusion 2.5 requires you to enter a number or text string. There are two types of functions in Clickteam Fusion 2.5 General, and Object. General Functions The General functions retrieve data from the Restricted objects that are only accessible in the Event Editor. The Restricted objects are Special, Sound, Storyboard Controls, Timer, Create New Objects, Mouse & Keyboard, and Player. For example, the Player functions let you retrieve the current value of the score and the current number of lives that a player has left. Other examples of General functions include retrieving the current frame number, the total number of objects in the frame, the current horizontal (X) position of the mouse, and the current timer count. Object Functions The Object functions retrieve data from objects other than the Restricted objects. The functions available depend on the type of object. For example, you can retrieve the speed, position, and alterable values of an Active object, the current track number of a CD-Audio object.

The Actions

Actions occur as a result of the conditions in your applications. Once a particular condition is detected, the associated action(s) take place. Each object type has its own set of actions that can occur when Clickteam Fusion 2.5 detects a condition. For example Lives objects can be gained or lost. Score objects can be increased or decreased. Storyboard objects can cause a jump to the next frame, cause a jump to the previous frame, restart the current frame, and end the application. Active objects can be moved, animated, or destroyed. You can access the object actions in the Event editor. Along the top line in the Event editor is a series of object icons representing the available action types. These icons differ depending on which objects you have included in your application. You can enter your actions by right-clicking a grid box under an icon and choosing an action from the pop-up menu. Ordering the actions within an event The order in which actions are added to an event determines the order in which those actions are executed when the condition of that event becomes true. The order of actions can be very important. For example, if your event has two conditions, one to increment a counter and another to select an item from a list which corresponds to the value of the counter, the order is very important. If the counter is currently at 1 and you increment it by 1, your event will select the second item in the list. However, if you perform the actions in the reverse order, the first item in the list is selected. To modify the order of the actions in an event after you’ve entered them, you can right-click the number of the event and select Edit the Actions. This opens the Event List Editor which displays only the actions for the selected event. You can drag and drop the actions in the list to change the order in which they are executed.

The Conditions

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

The Events

Every element that you add to your Clickteam Fusion 2.5 applications is a type of object. Each object can have any number of events, conditions, actions, and functions associated with it. Events are the foundation of your Clickteam Fusion 2.5 applications. Each event consists of one or more conditions, actions, and sometimes functions that you define in the Event Editor. Each event waits for a specific condition to occur in your application and then executes the associated actions. Conditions are tests within your applications that trigger actions. All actions depend upon Clickteam Fusion 2.5 detecting a condition and then executing the actions associated with it. Collisions, movement, and visibility are all examples of conditions. For example, two objects colliding, an object beginning to bounce, or the user clicking the mouse are all conditions that can trigger an action. Actions are triggered when a condition becomes true in an application. Once a particular condition is detected, the associated action(s) take place. Movement, visibility, and jumping to a new frame are all examples of actions. For example, an object can stop moving, become invisible, or jump to the last frame in the application as a result of a condition. An example of the interaction between an object’s events, conditions, and actions is a collision between a spaceship and a meteorite resulting in the destruction of the spaceship. The event is the combination of the condition (the collision between the spaceship and the meteorite), and the action (the destruction of the spaceship). Functions let you retrieve data from one object for use by another object or for use in an action. For example, if you want to display the number of lives that Player 3 has left in the Score object, you can use the Player object function Current number of lives to retrieve the number of lives in the Lives object for display in the Score object.