Is there a priority system for inputs? #92
Unanswered
drvelociraptor
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I haven't done much digging around with the base addon, but in the project I've been working on, I modified the FrayCompoundState so that get_next_transitions returns an array of transitions sorted by their priority. func sort_transition_priority(a: _Transition, b: _Transition) -> bool:
if (a.transition.priority > b.transition.priority):
return true
return false
func get_next_transitions(from: StringName) -> Array[_Transition]:
if _ERR_INVALID_STATE(from):
return []
var transitions: Array[_Transition]
for transition in _transitions:
if transition.from == from:
transitions.append(transition)
transitions.append_array(get_next_global_transitions(from))
transitions.sort_custom(sort_transition_priority)
return transitions
This then guarantees that the first transition that meets all prereqs and advance conditions is the one with the highest priority. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have two bind actions and a composite input using those too at the same time. The problem is one binded action key is for attack, so when the two keys are pressed together, the attack and the composite action happens at the same time. I believe one deals with this issue with a priority system? So if the composite is executed, the notmal attack would not happen. Is this possible in Fray?
Beta Was this translation helpful? Give feedback.
All reactions