Hello i want to allow support for half moon and quarter moon on the gamepad sticks to perform special tricks. What is the best way to tackle this?
fighting game input can be really complicated.
start with a string 4 letters long. i use “----”.
every time you push a button, append a letter to the string, then right chop 1 character from the string. i use the letters u, d, b, f, for up, down, back, forward, and 0 - 4 to represent face buttons. so “fdf3” would be forward, down, forward, X. every time you append a letter or number, a timer is set for .3 seconds, and if no input is received before the timer runs out, it resets the input string to “----”.
pressing a direction just appends a letter, but pressing a face button appends a number to the string, then calls a function that checks if the input string matches any of the moves in a character’s move set.
every move set is a struct that contains an array of move states. each move state is a struct that contains a MoveState name, and an array of AvailableAttacks. each AvailableAttack is a struct that contains an AttackState name, and 4 arrays of attacks. each attack is a struct that contains an Input string and a command name.
so a move state is like falling, grounded, swimming, etc… and AttackStates are things like idle, uppercut, jump kick, etc… so depending on your current move state and attack state, it narrows down the available moves to check against. usually, most moves require that you are grounded and idle, but combo moves might require that you are in a more specific attack state.
the reason i split attacks into 4 arrays, is based on the length of the input string. the EnterCommand function checks 4 digit inputs before checking 3 digit inputs, then 2 digit inputs, and finally 1 digit inputs. that way, if a 3 digit input is recognized, it stops checking for simpler inputs, so attacks with more inputs have higher priority.
Thank you for the detailed response, seems like a good starting point