public void move(int xa, int ya) { if (xa != 0 && ya != 0) { move(xa, 0); move(0, ya); numSteps--; return; } numSteps++; if (!hasCollided(xa, ya)) { if (ya < 0) movingDir = 0; if (ya > 0) movingDir = 1; if (xa < 0) movingDir = 2; if (xa > 0) movingDir = 3; x += xa * speed; y += ya * speed; } }