(April Fools) Opening and Closing Doors in Behaviors
As Behaviors comes closer and closer to completion, you may be wondering: How do I open and close a door with Behaviors?
Creating things should not be hard in Behaviors. Our goal is to make it easy to learn, while being very powerful.
When choosing what language to use, it is easy to get lost in the sea of syntax, so we need to consider it very carefully. Fortunately, we have found one of the greatest fits for Behaviors: Rust. Rust is easy to learn and powerful.
In other games, opening a door is simple: Write a ~150 line script to control the door, another ~300 line animation manager, and a ~500 line door manager to manage all door instances in the world.
Fortunately, in Brickadia Behavio.rs, we have streamlined the process. Want to write a door that opens and closes? No problem.
Here are a few basic things we need:
- Basic understanding of Rust code
- Ability to build a door out of bricks
- Have MSVC, LLVM, and the nightly Rust compiler installed (minimal profile is fine)
You will need to build for the behaviors-unknown-brickadia
target. You can do this with the
--target behaviors unknown-brickadia
parameter. Additionally, you need to depend on
behaviors-std = 0.1
to access the necessary game APIs.
Here is how you could implement your Door:
Now at this point, you should be able to see the door. Don't forget to write your animation manager and door manager, as that is crucial for the next step: Opening and closing the door!
I will leave the implementation of such as an exercise to the reader. Check out our version of the door!
As always, thanks for tuning in. If you have any questions, feel free to contact us through our various channels. Make sure to subscribe for more Behaviors related content!