What's the best practice for organizing your code when you want multiple ways to control the game? For me, I want to be able to use Keyboard(WASD and Arrow Keys), Analog stick on Xbox controller, and Dpad on Xbox Controller.
I don't want to put all four "LEFT" inputs into each line of code for what should happen when pressing Left. Do I just use one input to make my game, and then later, copy the code three times, into four groups, replacing the relevant inputs, and enabling the group that the user chooses?
Ideally, I'd like to say, when you press A, LEFT, Dpad Left, or Analog Xaxis -75, simulate a global thing called LEFT. Then, I can write code from there: When global thing LEFT, action action action etc. Obviously, I thought of using a global, but this doesn't seem like a great practice(though I'm very new). Am I wrong?
So, what's the best/better approach in organizing code for multiple ways to input LEFT?