jittery keyboard player control
in
Programming Questions
•
2 years ago
I'm using the keyboard to control a sprite. Generally the movement is quite smooth but sometimes it gets a little jittery and pauses for a second before moving when i change direction.
I'm getting the keyboard events this way:
if(keyPressed){
if(key=='w'){
playery--;
}
if(key=='s'){
playery++;
}
if(key=='a'){
playerx--;
}
if(key=='d'){
playerx++;
}
if(key=='b'){
fire=1;
}
}
http://pastie.org/2172292 (full code)
1