|
Glossary of Behaviors
Note: Behaviors in Stencyl are saved as .png files. (The code is stored in the image file's metadata). Individual behaviors can be downloaded by right-clicking on the icon, and selecting "save image as.."
|
Warning: The Mathematics Development Engine Extension should be enabled before any behaviors are imported! Otherwise, you may see errors about "missing blocks".
|
|
Warning: Internally, variables names are preceeded by an underscore. (e.g. "Expression" would be represented as "_Expression" internally). When certain attributes (such as "Targets") requires listing a variable name, the underscore should be included. Global variables do not need underscores.
As a quick rule of thumb, whenever you need to type the name of a variable anywhere, use the internal name--that is, precede with an underscore.
|
Standard Behaviors
|
2D Graph Output Behavior
Actor will generate a 2D graph of a single-variable function, printed in a specified region.
Notable Variables
Independent Variable | e.g. x |
Expression | The right-hand side ofthe equation, following y= |
Draw on Creation | The graph will be drawn when the actor is created, rather than on event call |
Events
Activate | Shows the graph (actor is active by default) |
Deactivate | Hides the graph |
DrawGraph | Generate and display the graph. Event must be called if Expression has been changed. |
|
|
Basic Input Field Behavior
Actor generates an input field, displayed in a specified region.
Notable Variables
_Contents | Stored value of the input field |
Acceptable characters | Characters the input field will accept, separated by commas |
Use Alphabet... | If checked, will include the standard alphabet as acceptable characters |
Fixed Text | Text that is always displayed, but not part of the contents |
Targets | Variables the input field will submit values to. Variables should be listed as ID.behavior.variable |
Event Trigger | Events should be listed in the form event|unique id. Each listed event will be triggered in all behaviors for all actors with specified Unique Id. |
Events
Activate | Enables and displays the input field (actor is active by default) |
Deactivate | Hides the input field |
SendContents | For every varaible in Targets, replace its value with _Contents. Events listed in Event Trigger will be called. |
|
|
Button Input Behavior
When attached to a button, provides functionality to submit values to specified variables.
Notable Variables
Targets | Variables the button will submit values to. Variables should be listed as ID.behavior.variable |
Value | The value to be submitted |
Value is a Variable | The specified value is the name of a variable |
Send on Click | If checked, SendContents event will be called when button is pushed |
Append | If checked, Value will be appended to the specified (text) variable |
Events
SendContents | For every varaible in Targets, replace its value with _Contents. Events listed in Event Trigger will be called. |
|
|
Calculator Output Behavior
Actor will generate a text box in a specified region, into which calculator outputs are fed.
Notable Variables
NewInput | Holds an expression to be evaluated. |
Events
Activate | Shows the output (actor is active by default) |
Deactivate | Hides the output |
Calculate | Evaluates the expression stored in NewInput, and copies the input and output to the display |
|
|
Click and Drag
Allows the attached actor to be dragged by the mouse pointer.
|
|
Fixed Image Display
Actor will generate a 2D image inside a specified region.
Notable Variables
Image File | Name of image file. Image should be placed in /extras folder. |
Image File is URL | If checked, the specified file is a URL. The image will be downloaded and displayed. |
Events
Activate | Shows the image (actor is active by default) |
Deactivate | Hides the image |
|
|
Hide Actor
Hides the actor this behavior is attached to. This behavior is typically attached to "generator" actors--actors which generate graphs, input fields, etc.
|
|
Input Palette Generator Behavior
Actor will generate a numerical input palette in a specified region.
Notable Variables
Targets | Variables the button will submit values to. Variables should be listed as ID.behavior.variable |
Event Trigger | This event will be triggered in all behaviors for the attached actor when the submit button is clicked |
Events
Activate | Shows the palette (actor is active by default) |
Deactivate | Hides the palette |
|
|
Label Behavior
Actor will generate a label, displayed in a specified region. The label displays text, but no user input. This behavior is a general-purpose text display behavior.
Notable Variables
Contents | Text that the label displays |
Contents Type |
The type of contents that the label contains. Options are:
Literal | Label displays the Contents variable verbatim |
URL | Label will visit the URL specified in the Contents variable, and display the page |
Local | Label will read the file specified in the Contents variable, and display the text |
|
Open URL on Click | If checked, user's web browser will open when the label is clicked |
URL | If Open URL on Click is checked, specifies the URL to visit |
Word Wrap | Automatically wraps text to the next line |
Auto Update | If checked, display will update when Contents is changed. If not checked, Initialize event must be called. |
Events
Activate | Shows the label (actor is active by default) |
Deactivate | Hides the label |
Initialize | Initializes (or re-initializes) the label |
|
|
List Based Graph Output Behavior
Actor will generate a list-based graph of a set of data points, printed in a specified region.
Notable Variables
Initial Data Points | List of coordinates in form x,y |
Events
Activate | Shows the graph (actor is active by default) |
Deactivate | Hides the graph |
|
|
Navigate on Event
Switches to a specified scene when Navigate event is called.
Events
Navigate | Switch to the specified scene |
|
|
Navigate Button Behavior
Attaches to a button actor; switches to a specified scene when the button is pushed. Note: This behavior listens for user input (mouse, or touch). The ButtonPush event is called when the user clicks the button.
Events
Activate | Shows the button (actor is active by default) |
Deactivate | Hides the button |
ButtonPush | Switch to the specified scene |
|
|
Polynomial Input Field Behavior
Deprecated. This behavior is used by a few of the older actors in the Actor Library. Basic Input Field Behavior should be used, instead.
|
|
Push Button Behavior
Attaches to a button actor and listens for user input (mouse, or touch). When the button has been pushed, behavior will trigger a list of specified events.
Notable Variables
Event Trigger | Events should be listed in the form event|unique id. Each listed event will be triggered in all behaviors for all actors with specified Unique Id. |
Events
Activate | Shows the button (actor is active by default) |
Deactivate | Hides the button |
ButtonPush | Trigger the events specified in Event Trigger |
|
|
Response Recorder
Stores data in specified global variables. The data will be retrieved from a specified actor.
Notable Variables
Target Actor | The actor to listen to for data |
Behavior | The actor's behavior to listen to for data |
Variable | The variable to retrieve data from |
Storage Variable | The global variable to store data in |
Restriction | A global boolean variable that will be set to true when a value is stored in Storage Variable. When a response has been recorded, further requests for storage will be ignored. |
Events
Record | Performs the value storage action |
|
|
Scrollbar Behavior
Actor will generate a scrollbar in a specified region.
Events
Activate | Shows the scrollbar (actor is active by default) |
Deactivate | Hides the scrollbar |
|
|
Simple Image Display
Actor will generate an image, displayed in a specified region.
Notable Variables
Image File | The image to display |
Image File is URL | If checked, Image File refers to a URL. The image will be downloaded and displayed |
Events
Activate | Shows the image (actor is active by default) |
Deactivate | Hides the image |
LoadImage | Loads the image into memory |
LoadInstance | Displays the image |
|
|
Simple Push Button Behavior
Attaches to a button actor and listens for user input (mouse, or touch). When the button has been pushed, behavior will trigger a list of specified events. Events are limited to behaviors attached to the same actor.
Note: Push Button Behavior is a more general, flexible behavior.
Notable Variables
Event Trigger | Events should be listed, separated by commas. Each listed event will be triggered in all behaviors for the actor attached to this behavior. |
Events
Activate | Shows the button (actor is active by default) |
Deactivate | Hides the button |
ButtonPush | Trigger the events specified in Event Trigger |
|
|
Unique Identifier
Gives the actor a specified, unique name. This behavior is required by many of the other behaviors which use a Targets variable.
|
Example Application Behaviors
These are the behaviors used in the example applications.
|
Cannonball Behavior
Provides the functionality for the cannonball in the physics demonstration.
|
|
Cannon Behavior
Provides the functionality for the cannon in the physics demonstration.
|
|
Golf Ball Behavior
Provides the functionality for the golf ball in the physics demonstration.
|
|
Golfer Behavior
Provides the functionality for the golfer in the physics demonstration.
|
|