iam4x / pokemongo-webspoof

👾 Play Pokémon Go from your Mac
2.14k stars 228 forks source link

Move over diagonal when pressed 2 keys #401

Closed iworker closed 7 years ago

tselincoln commented 7 years ago

I have been playing around with the codes and find a way to do that, by modifying the file src/views/map/controls.js. Do the following: // window.addEventListener('keydown', ({ keyCode }) => { // switch (keyCode) { // case 65: // case 81: // case 37: { handleMove('LEFT');handleMove('UP');return } // case 87: // case 90: // case 38: { return handleMove('UP') } // case 68: // case 39: { return handleMove('RIGHT') } // case 83: // case 40: { return handleMove('DOWN') } // default: return undefined // } // })

var map = []; onkeydown = onkeyup = function(e){ var direction = { '37': 'LEFT', '38': 'UP', '39': 'RIGHT', '40': 'DOWN'}; e = e || event; map[e.keyCode] = e.type == 'keydown'; for(var i = 37;i <= 40;i++){ if(map[i]){ handleMove(direction[i]); } } }

hope it helps!