The BaseNode class is used as super class to all nodes in BehaviorJS. It comprises all common variables and methods that a node must have to execute.
IMPORTANT: Do not inherit from this class, use
The attributes are specially designed to serialization of the node in a JSON
format. In special, the
parameters attribute can be set into the visual
editor (thus, in the JSON file), and it will be used as parameter on the
node initialization at
BaseNode also provide 5 callback methods, which the node implementations can
override. They are
exit. See their
documentation to know more. These callbacks are called inside the
method, which is called in the tree traversal.
Wrapper for close method.
Wrapper for enter method.
This is the main method to propagate the tick signal to this node. This
method calls all callbacks:
exit. It only opens a node if it is not already open. In the same
way, this method only close a node if the node returned a status
The tick state.
Wrapper for exit method.
Wrapper for open method.
Wrapper for tick method.
A state constant.
Close method, override this to use. This method is called after the tick
callback, and only if the tick return a state different from
Enter method, override this to use. It is called every time a node is asked to execute, before the tick itself.
Exit method, override this to use. Called every time in the end of the execution.
Open method, override this to use. It is called only before the tick callback and only if the not isn't closed.
Note: a node will be closed if it returned
b3.RUNNING in the tick.
Tick method, override this to use. This method must contain the real execution of node (perform a task, call children, etc.). It is called every time a node is asked to execute.
Node category. Must be
b3.CONDITION. This is defined automatically be inheriting the
Node name. Must be a unique identifier, preferable the same name of the class. You have to set the node name in the prototype.
A dictionary (key, value) describing the node parameters. Useful for defining parameter values in the visual editor. Note: this is only useful for nodes when loading trees from JSON files.
A dictionary (key, value) describing the node properties. Useful for defining custom variables inside the visual editor.