Node Copied to Clipboard!

If Node

The if statement allows you to execute the first line of flow, otherwise it will assume false and execute your second line of flow.

This scene is setup with three possible options to click on.

First drag one of the three possible options from editor window to the Storyboarder.

Click and drag from the objects bottom handler, there are many options, but for now we will select Is Clicked.

Click the bottom handler of the Is Clicked node and select the If node.

Copy over the object in the story border by right-clicking on the object and select copy then paste, or hold down Alt and left click drag to copy.

Delete the IsClicked and If nodes and replace them with the Animate node.

Right-click drag from the object's bottom handler and select the Animate node, enter a value in the Animate node to make it animate.

Connect the If Node to the Animate Node.

Right-click on the storyborder, hover over the Controls option and select Loop.

Connect the Loop Node to the Setup Node and the If Node. Note that top right handler of the Loop Node is connected to the If Node. If you play the lesson now, every time you click the object will animate once per click and loop over.

Select the If Node and look at the properties menu, there is an Else property and on the most right of it you will see an x click it to reveal the Else slot in the If Node.

Select the Is Clicked Node + If Node + Animate Node (hold ctrl to select multiple nodes or drag over the area). Copy over the Nodes selected by right-clicking on the Nodes and select copy then paste, or hold down Alt and left click drag the object to copy.

Drag the second possible option from the editor window to the story border and duplicate it.

Undock the Sphere object on the second If and Animate nodes by holding shift while dragging it. Delete these undocked sphere nodes and connect the second object to the IsClicked and Animate nodes.

Connect the Else slot from the first If Node to the main flow of the second If Node.

Drag the third and final possible option object from the editor window to the storyborder and attach it to a IsClicked & If Node.

Click and drag from the upper right side handler and select Message Box, and type in the text "Try Again". Then connect the Else slot from the second If Node to the main flow of the third If Node.

Now when you play the lesson you will have three possible options.

  • Option one will animate the first object.
  • Option two will animate the second object.
  • Option three will play a message box reading "try again".

Simulation Path

Along with the Else property, the if node also has the Simulation Path property. That indicates which line of execution should be followed when simulating to a node further along the flow of execution.

To simulate to the MessageBox node for the image example above, you would need to switch the if node's simulation paths.

Set the simulation path of the first and second if statements to "always false" to make it simulate through their else statements.

Set the simulation path of the third if statement to "always true" to simulate to the messagebox node.

Node