Pause when holding down key
So I draw an object on the screen at objectx, objecty and increment
objectx when right arrow is pressed, moving the object to the right. The
problem I'm running into is that if I hold the right arrow key down it
increments once, pauses, and then increments repeatedly. My question is
why does it do this, and how can I make the object move fluidly without
that initial pause?
$(window).keydown(function(e) {
if(e.keyCode == 39) {
objectx++;
}
}
No comments:
Post a Comment