This post details how to use gamepad support on Scratch (you can also run TurboWarp with a project of your choice to get the same feature, follow steps 3-5)
*Only works on Chrome, Edge, or Firefox. Doesn't work on mobile.
Install Scratch Addons: https://scratchaddons.com/#features
Once installed, click on the extension icon (probably in the top right near your profile picture, if it doesn't show click on the puzzle piece/extension menu and click the "Scratch Addons" extension.)
Go to the "addons" tab in the mini-menu and search for "gamepad". The desired option will show. Enable it.
Open a Scratch project, and click the gamepad icon next to the full screen button (you will need to wait for the project to load). Find the keys you want to assign to keys on your gamepad (look in the description). Make sure your gamepad is connected, and try clicking buttons on it to see which keys are assigned to buttons in the interface.
The gamepad should be able to control various functions in the project that are assigned to keys. If the project does not have keyboard functions, try remixing/seeing inside and adding them yourself.