Variables
Last updated
Was this helpful?
Last updated
Was this helpful?
Variables allow modifying built-in properties on objects (such as the position of an entity) or the creation and modification of new properties (such as a character's max movement speed). The FRB Editor includes three types of variables:
Tunneled variables - variables which can be added to a screen or entity that provide access to a variable of an object contained within the screen or entity. For example, a Bullet entity may tunnel to its contained CircleInstance.Radius so each bullet instance Radius can be modified.
New variables - variables which do not have any built-in functionality, but which are added through the editor and used in custom code. For example, an explosive enemy may have a SecondsBeforeExploding variable which is used in custom code to make the enemy explode after a certain amount of time.
Exposed variables - variables which are available in code but not available (by default) on an entity. Exposed variables expand the available variables on an entity or screen. For example, an Entity may expose its RotationZ variable so that instances can be rotated in live edit.
There are a few ways to add a new variable.
To add a variable in the Variables tab
Select the screen or entity
Select the Variables tab
Click the button to add a new variable
To add a variable by right-clicking:
Expand an existing screen or entity
Right-click on the Variables folder
Select Add Variable
This will bring up the New Variable window which is used to select the variable type and set options according to the selected variable type.
Exposing an existing variable enables editing a variable which would otherwise only be available in code. The variable dropdown provides a list of available variables for the selected object. Note that this type of variable creation is rarely used.
Tunneled variables enable exposing a variable from a contained object to that it is editable at the entity level. For example, consider an Enemy entity with an AxisAlignedRectangle instance.
You may want to change the color of the AxisAlignedRectangle per instance (or through a State). To do this, you can tunnel in to the variable. To do this:
Drag+drop the AxisAlignedRectangleInstance onto the Variables folder
Use the dropdown to select the desired variable - Color
Optionally - change the Alternative Name
Click OK
Note that variables can be tunneled by right-clicking on the Variables folder, but this drag+drop approach auto-selects the Tunnel a variable in a contained object option, and selects the object in the Object dropdown.