Node Copied to Clipboard!

Operators


Is Equal

The Is Equal is a binary operator that takes two arguments and compares whether they are equal or not (True or False). The resulting boolean will be passed through the bottom handle of this node.

Right-click on the storyboard to add the Is Equal node under Operators.

Open at least two argument slots. Usually it is used to compare some variable value and a constant value of the same type. For example, you can compare the value of an integer variable with a constant integer or an object property against a boolean. You can compare more than two arguments as well.

Is Equal pairs well with If and Branch nodes. In This example the lesson will only animate and unhighlight the sphere only if the sphere was highlighted before. Therefore we won't be trying to unhighlight an object that was never highlighted to begin with.

Is Equal is often used to create arguments for the And and Or operators also discussed in this article.

Is Not Equal

As seen above we can use Is Equal to compare if values are equal to each other. To check if values are unequal we can use the Is Not Equal node.

This node can be used the same way as Is Equal but it returns True if the values are not equal and False if they are.

Not

Not can be attached to the bottom of any node that produces a true or false value. This is usually used to check boolean properties such as isHighlighted or isVisible.

To use Not, drag the object to the storyboarder, dereference the property you want to check and dereference the Not node from that.

In this example, we dereference an if node so that the object will become visible if it is currently not visible.

And

The And node will return True only if all of its arguments result to True.

You must provide at least two arguments with boolean results.

The example above uses two Is Equal Nodes as arguments. If both the red and white wires are visible then the lesson will play the True branch. If one or both of the wires is not visible then it will play the False branch.

Or

Using the exact same example as the And node but replacing the And with the Or node yields a different result. Now, the True branch will play when both wires and even if just one wire is visible and play the False branch only when both wires are not visible.

Is Less Than

Takes two arguments and returns True if the first argument is less than the second argument and False otherwise.

The example above will highlight the sphere if the variable num is less than 0 and highlight the box if it is greater than or equal to 0.

Is Greater Than

Takes two arguments and returns True if the first argument is greater than the second argument and False otherwise.

The example above will highlight the sphere if the variable num is greater than 0 and highlight the box if it is not.

Is Greater Than Or Equal

This node works the same as the Is Greater Than node except it returns true if the first argument is greater than or equal to the second and False if it is less than it.

Is Less Than Or Equal

This node works the same as the Is Less Than node except it returns true if the first argument is less than or equal to the second and False if it is greater than it.

Divide

The Divide node will divide the first argument by the second argument. If there is more than two arguments it will take the result of the division and divide it by the next argument below.

In this example, it will do 10/2 = 5 and then 5/2 = 2.

Note: because we are using the int type it will perform integer division (how many times 2 can fully go into 5, with no decimal places). If you use the float type you will get the expected decimal answer.

Cast

If you are in a situation where you have an int variable and wish to obtain the decimal result of a division, for example, you can use the cast node. You can cast your int variable to a float type and then perform the division.

With our int variable "Num" click the bottom handle to dereference a cast node, right-click in the empty parameter slot and select float(type).

We have now cast the int(type) variable to a float(type) for the time being. Unconnected from the cast node "Num" will still be an int.

Right-click the storyboarder and select the Divide node.

Drag the bottom handle of the cast node we created and connect it to the first parameter handle of the Divide node.

Fill the second parameter slot with a float variable or constant.

This completed node will now result in the decimal division of the two numbers.

Modulo

The Modulo operator gives the remainder of a division.

For Example, 5 modulo 2 = 1 because 2 goes into 5 evenly 2 times and leaves one left over.

Multiply

The Multiply node works as you would expect by multiplying all of its arguments together. It takes at least 2 arguments.

Add

The Add node will add together all the arguments you give it. It takes at least 2 arguments.