+1 vote

So I have a state machine like this:

enum {Move, Attack}
var state = Move

func physics(delta):
    match state:
         Move:
             do_moving()
         Attack:
             do_attack()

And I want to do the attacking (animation or whatever it does), while responding the Move state (like still moving, but change the animation for example), switching the state to Attack should never work i guess, what's the better solution?

in Engine by (78 points)

1 Answer

0 votes

This is a good video tutorial about using two state machines together:
https://www.youtube.com/watch?v=BQwNiU5v9as

by (860 points)

Yeah I've already saw it some times, I think is too complex and maybe isn't the best way or the way I'm looking for, but thank you very much anyway!

I don't have a lot of information to work with from your posts, but I would suggest that you try to master the use of a single state machine before attempting the additional complexity of combining them.
https://www.youtube.com/watch?v=j_pM3CiQwts

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.