The function you pasted shows you how to bit shift things over...
although you might need to specify like Serial.print(x,BYTE);
Serial.print((address << 4) | state, BYTE);
Serial.print((x << 4) | y, BYTE);
well, if you need to clean up input:
Serial.print((address << 4) | (state & 0x0F), BYTE);
Serial.print((x << 4) | (y & 0x0F), BYTE);