Why not unpack these in to deltaX, deltaY, and deltaDirection? The code below with the 0/1/2 indexes is hard to mentally parse.