Returns True if touching any pixels [on specified side].

            0 = Bottom
            1 = Left
            2 = Top
            3 = Right
            None = All

            This works by creating a list of the image rotated so all the
                requested sides are facing up, then it finds the top edge for
                each image and rotates the coordinates back to the original
                image.

def touching(self, canvas, side=None):
        """
            Returns True if touching any pixels [on specified side].

            0 = Bottom
            1 = Left
            2 = Top
            3 = Right
            None = All

            This works by creating a list of the image rotated so all the
                requested sides are facing up, then it finds the top edge for
                each image and rotates the coordinates back to the original
                image.
        """
        try:
            sides = list(side)
        except TypeError:
            if side is None:
                sides = list(range(4))
            else:
                sides = [side]

        # Generate rotated images for each direction.
        images = {}
        image = self.image.image()
        for side in sides:
            images.update({
                (side + 2) % 4:
                    funcs.rotateImage(image, (side + 2) % 4)
            })

        # Go through each image finding top edge,
        #   then rotate coordinates to match original image.
        edges = []
        for side, image in images.items():

            for x in range(len(image[0])):
                y = 0
                # If the first pixel is True, no look any further.
                if not image[0][x]:
                    while not image[y][x]:
                        y += 1
                        if y >= len(image):
                            # Fallen off bottom of image, therefore no edge.
                            y = None
                            break

                # Don't do anything if no pixels in column.
                if not y is None:
                    y -= 1  # To get pixel next to pixel which is on.

                    # Get coordinates the right way around.
                    pos = (x, y)
                    size = [len(image), len(image[0])]
                    for i in range(4 - side):
                        size.reverse()
                        pos = funcs.rotatePosition(pos, size)
                    edges.append(pos)

        # Find if any other sprites are in our edge coordinates.
        for pixel in edges:
            pixel = (int(self.position[0] + pixel[0]),
                     int(self.position[1] + pixel[1]))
            if canvas.testPixel(pixel):
                return True
        return False