2D Behavior Tree Project
Controls
- Keyboard: Z, X, Enter, Escape, Arrow Keys
- PS4: Left Stick, Start, X, Square
- Xbox: Left Stick, Start, A, X
Note: The HTML5 version may have an odd input map depending on your browser.
2D Behavior Tree Project (2020)
I made this small project so I could understand state machines and behavior trees better.
I separated control from state in this demo with the use of a generic controller node and a state machine node. With this design you can swap controllers between the squid and the enemies (editor-time), allowing you to control any character in this game.
For the enemy controllers I implemented a behavior tree system that was easy to use in Godot's scene graph. Creating custom nodes was the right move, because it made use of the editor's built-in scene graph. That was much easier to manipulate than creating a new editor from scratch.
Behavior Trees
This is an example of a behavior tree in the editor. This one is for the spitting pumpkin enemies. This uses selector nodes, sequence nodes, inverter nodes and what I called "function" nodes. These leaf nodes are configured in the details panel and execute code that lives on the enemy controller.
State Machine & Controller
Each character implements their own state machine and transitions, as well as their own controllers. You can swap the controller out for a player controller, which will allow you to play the game as another type of character.
Here's a demo of a playable pumpkin enemy. Simply changing the enemy's controller to a player controller allows you to do everything the enemy is capable of!
Status | Released |
Platforms | HTML5, Windows, Linux |
Author | Luft |
Genre | Platformer |
Tags | 2D, Pixel Art, Singleplayer |
Install instructions
Extract all files from the zip file.
Leave a comment
Log in with itch.io to leave a comment.