Created
March 11, 2014 17:03
-
-
Save asmaps/9490209 to your computer and use it in GitHub Desktop.
This file contains 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
var jq = document.createElement('script'); | |
jq.src = "//ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
var left = new Event("keydown"); | |
left.which = 37; | |
var up = new Event("keydown"); | |
up.which = 38; | |
var right = new Event("keydown"); | |
right.which = 39; | |
var down = new Event("keydown"); | |
down.which = 40; | |
function play() { | |
document.dispatchEvent(left); | |
document.dispatchEvent(up); | |
document.dispatchEvent(right); | |
document.dispatchEvent(down); | |
if(!$('.game-message').hasClass('game-over')){ | |
setTimeout(play, 10); | |
} | |
else { | |
setTimeout(function(){$('.retry-button').click();play();}, 1000); | |
} | |
} | |
play(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment