// Figure out the next tile to move to, based on direction from key press public void MoveInDirection(Vector2 dir) { PositionUtility.CalculatePosition(currentTile, map.columns, out tmpX, out tmpY); // Add direction values to temp x and y tmpX += (int)dir.x; tmpY += (int)dir.y; // Create index of tile to move to PositionUtility.CalculateIndex(tmpX, tmpY, map.columns, out tmpIndex); // Move player to next tile, with animation MoveTo(tmpIndex, true); }