updates globalX and globalY on keypress