Variables
Last updated
Last updated
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
New variables - variables which do not have any built-in functionality, but which are added through the editor and used in custom code
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.
Variables can be added to creens and entities by following these steps:
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.
To add a new variable:
Right-click on the Variables folder
Click the Create a new variable option
Select the type such as float
Enter a name such as MaxSpeed
Click OK