The Branch node is used to create branched scenarios in your lessons. Depending on user choice, Branch allows multiple outcomes to the lesson. A good comparison would be to think of Branch as a garden hose with a switch. The switch will determine the path in which the water flows, with the switch being the user’s choices in the lesson.
The most common way to use a Branch node is to first create a “Wait For Any Click” node. Drag from the bottom handle of Wait For Any Click, and select Branch from the list.
Branch has multiple slots that can be added to have many different outcomes. To add a slot click the ‘+’ button on the left-side of the node. This adds a slot that an object node can be dragged into.
Alternatively, you can drag the object directly to the slot and it automatically adds it to a new slot.
You can also drag from the right handle of a node to attach it to a slot in the Branch as seen below:
Each slot in the Branch has a corresponding path which will be executed depending on the user’s choice. For Example, either the box, cube, or sphere will be animated depending on which shape the user clicks. In this way, the Branch can be used to create many different outcomes in your lesson.
There may also be a situation where the user does not click any of the shapes. We can catch this branch as well by using the else parameter.
To get the else parameter to appear on our node we first click on the branch node to see its properties appear in the properties tab.
Ungraph the else parameter by clicking the ungraph button to the far right of the else property.
This else parameter will catch all other user clicks, add a messagebox as its argument and write a message that instructs the user where to click.
Add a loop node in front of the branch so that it will continuously check for user clicks.
Along with the Else property, the branch 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 dereferenced setup node in the image example above you would need to switch the branch's simulation path to value4 to simulate through the fourth argument.Node