If Lives Icon If Lives

This action is used to check the value of the instance variable lives using a specific expression. You give the type of expression to check with and the value to check the current lives against, and the "if" statement will always return either true or false depending on the expressions and values used. The available expressions are:

If you flag the Not argument, then the above will be negated expressions, for example "equals to" becomes "not equals to", so you would be checking if the lives value is not equals to the given value.

IMPORTANT Due to floating point precision issues, checking to see if two values are exactly equal may return false, since one may be exactly 1, while the other may be 1.00000000000001. This can be avoided by using the Decimal To Integer action before checking or using the "greater than" or "less than" expressions.

Note that to add actions into the "if" block, they should be dropped to the side of the action, as shown in the image below:

If Lives drop actionsThese actions will now be run if the "if" evaluates to true, while any actions dropped elsewhere will be performed after the "if" block.

 

Action Syntax:

If Lives Action

Arguments:

ArgumentDescription
NotSet to check if the expression does not evaluate to true.
ExpressionThe type of expression to use for the check.
ValueThe value to check the lives against.

 

Example:

If Lives ExampleThe above action block code will check the value of lives to see if it is less than or equal to 0 and if it is then the room will be restarted.