function pressUp(){ | |
pressKey('up'); | |
} | |
function pressRight(){ | |
pressKey('right'); | |
} | |
function pressDown(){ | |
pressKey('down'); | |
} | |
function pressLeft(){ | |
pressKey('left'); | |
} | |
function pressLeft(){ | |
pressKey('space'); | |
} | |
function pressKey(key){ | |
var e = jQuery.Event("keydown"); | |
switch( key ){ | |
case 'up': | |
e.which = 38; | |
break; | |
case 'right': | |
e.which = 39; | |
break; | |
case 'down': | |
e.which = 40; | |
break; | |
case 'left': | |
e.which = 37; | |
break; | |
case 'space': | |
e.which = 32; | |
break; | |
} | |
e.keyCode = e.which; | |
$("body").trigger(e); | |
} | |
function anaylize(){ | |
setTimeout( function(){ | |
pressDown(); | |
anaylize(); | |
}, 200 ) | |
} | |
anaylize(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment