Click on the example then use a gamepad (D-pad or stick) to move the player character around the screen. Keyboard controls will still work.
Fully understand the concept by watching the tutorial in full screen at high res.
Once you have watched the video, you can refer to the code below to help you make your own that fits your game. Make sure you type it yourself to help you learn.
We can use the 'or' operator to make movement work if either the keyboard or the gamepad gives input.
If we want a specific gamepad only we can use gamepad[0] for the first gamepad connected, gamepad[1] for the second gamepad etc. (see below)
Note: You can get a list of all the fields in the "gamepad" object, and whether each button is being held down, by typing "gamepad" in the console and hitting enter when your program is running.