On my current project, I've blazed a new trail for myself and am including support for remapping keys on the keyboard in-game, as well as gamepad support. I've been messing around with and testing Joystick 2, seems like that's what everyone uses. It feels very similar to the Keyboard Object, in that you test if a keypress is happening and that keypress matches the ID that's stored in order to determine if that key is supposed to do something.
Today, CT tweeted a video for VACCINE, which was pretty cool to see how weird the data is that comes out of the controllers, and what it does to simplify it. However I think for my purposes, the gameplay is fairly simple and I'm not sure I really need a robust system like that. Basically, I'm planning to setup the gamepad code to be just like the keyboard code:
Repeat while LeftKey is pressed ("LeftKey" being the name of a global value that stores the key value set on an in-game options screen)
- Do stuff
Likewise, I'll have globals set to the button values, and check if those are pressed. What I'm curious about is, will this work universally as long as the player has set their controller on the option screen? The game is a retro platformer: left/right, jump, shoot, use jetpack. I don't think I will need anything complicated to make this work. As long as they set their preferred buttons and those values are stored, it should work? The only thing I can maybe see there being issues with after watching the video is the sticks or analog triggers, which I'll have to figure out on their own.
I have tested a couple random gamepads, including an N64 controller with USB adapter, and my tests all seem to work fine. Just curious if I'm oversimplifying and setting myself up for failure.