Will the attached code help? 1 << 14 gives you the a number that in binary is just a 1 at the 14th bit. You then OR it with the tile number to combine them together. Once you have done it often enough it will make sense. But it can cause headaches the first few times. Just think of bits 12 to 15 as a bunch of true or false flags. You want to turn them on or off.