Solved:time lag as encoders control the mouse via Arduino serial communication

By the way, when I comment out the game playing part in my code like map() and the mouse.move()function, the z always gives me the correct way I need. No matter how fast I move my robot. The another thing is, when I select the angry bird game with z = 1, the mouse cursor control seems fine even when I move the robot swiftly. I assume that is because the mapped range for the angry bird game is small not large. But the mapped range when z = 2 is quite large.

void angryBirdGame(){ //z=1

  thumbAngle_pixel = map(thumbAngle,0,130,28,13); //this function maps the thumb angle from encoder to the game computer pixel setting
  fingerAngle_pixel = map(fingerAngle,0,480,70,88);
  Mouse.move(thumbAngle_pixel, fingerAngle_pixel, 0); 
}

void bubbleShootGame(){ //z=2
  thumbAngle_pixel = map(thumbAngle,0,180,80,0);
  fingerAngle_pixel = map(fingerAngle,0,480,100,0);
  Mouse.move(thumbAngle_pixel, fingerAngle_pixel, 0);
}

The Arduino website mentioned about the fact that the Arduino microcontroller can not take the encoder with high speed and high resolution. But my case is a little different. The Encoder is not directly connected to my Arduino Leonardo. The encoder is connected to the robot computer and I wire my Arduino Leonardo RX TX (serial1) to RS232 of robot computer to get encoder data sent in.