Some context for what I am doing.
For a while, I have been feeling overwhelmed when looking at the flowcharts in my AnimationTree for both my enemies and my player. And I’ve been wanting to simplify it without sacrificing features. So I thought the solution could be nested state machines. So currently I’m trying it out on a new enemy so as to get the hang of it first. And as of writing this the enemy can only walk and idle
I’ve been reading the godot doc on AnimationNodeStateMachine, but I’m having some trouble understanding how it works (prob due to lack of experience)
The disconnected animations are just placeholders to show what’s inside the StateMachine nodes.
So here’s my question:
How do I set up these nested statemachines? and are there certain precautions(?) I should be wary of when making this. Is there any specific code that needs to be written for the statemachines to work?
From your diagram it looks like you set them up correctly.
Start small. Get something simple working before you jump into multiple layers or you won’t know from whence your problem stems - nesting or your lack of knowledge of AnimationStateMachines.
No. But. You should be putting them inside an AnimationTree they don’t work on their own. From your title it sounds like you did that.
I strongly recommend you google Godot 4 AnimationTree Tutorial and watch a bunch of videos. What you’re trying to do is super complex and answers on a forum are not going to be enough. On the bright side, once you do some tutorials, you’ll see how it all works and it will become pretty easy for you to implement your own ideas.
I strongly recommend you google Godot 4 AnimationTree Tutorial and watch a bunch of videos.
Yeah that’s what I’ve been doing so far. I am a big believer in learning by doing and this way is how I’ve learned to use godot although I’m at a point where it’s hard to find tutorials that show how to make the things I want to.
Currently I’m experimenting with expressions instead of using conditions to transition between states to simplify my code as much as possible. And ngl I’m having a little trouble finding a way to a solution that feels good