added a check for the space key; only send packet if the space key has been pressed or released.