Created
December 1, 2020 16:20
-
-
Save ccondry/d553104c6a749b387117ea486ff84811 to your computer and use it in GitHub Desktop.
enable gamepad support on slither.io game. works with PS4 and similar controllers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!function(){if("getGamepads"in navigator){var t=function(){var e=navigator.getGamepads()[0];if(e){var a=e.axes[0],i=e.axes[1];Math.sqrt(a*a+i*i)<.1&&(a=i=0),xm=100*a,ym=100*i,setAcceleration(e.buttons[0].value);var n=mc.getContext("2d");n.save(),n.beginPath(),n.strokeStyle=e.buttons[0].value?"white":"lightGreen",n.arc(xm+mc.width/2,ym+mc.height/2,8,0,2*Math.PI),n.stroke(),n.restore()}window.requestAnimationFrame(t)};t()}}(); void(0); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment