Skip to content

Commit

Permalink
Add Upgrading notes for upgrading to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Calamari committed Jan 3, 2018
1 parent 215cbaf commit 3667afc
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions UPGRADE_TO_V2.md
@@ -0,0 +1,20 @@
# Upgrade Guide to v2.0 from v1.0

The most notable change is, the way how to import the behavior tree components. The components are not static parts of the BehaviorTree class anymore. And since we are using proper ES5 notation, the BehaviorTree is now the `default` export of the component. This should look like this now:

```js
import BehaviorTree, { Selector, Task, SUCCESS } from 'behaviortree'
```

Additionally, to avoid the awkwardness of previous internal code, Tasks will now need to return a single value at the end, instead of calling one of the `this.running`, `this.success` or `this.fail` methods. Those methods do not exist anymore. Please return the provided constants to notify if the task was a success or failure or if it is still running and need to be called again.

```js
import { Task, SUCCESS } from 'behaviortree'
const task = new Task({
run () {
return SUCCESS
}
})
```

The Priority Selector is now called simply `Selector` according to more common terminology.

0 comments on commit 3667afc

Please sign in to comment.