public EnumSet<Border> getBorders(AbstractSprite sprite) {
        EnumSet<Border> ret = EnumSet.noneOf(Border.class);

        if (sprite.getX() <= 0)
            ret.add(Border.LEFT_BORDER);
        else if (sprite.getX() + sprite.getWidth() >= getWidth())
            ret.add(Border.RIGHT_BORDER);
        if (sprite.getY() <= 0)
            ret.add(Border.TOP_BORDER);
        else if (sprite.getY() + sprite.getHeight() >= getHeight())
            ret.add(Border.BOTTOM_BORDER);

        if (sprite.getX() + sprite.getWidth() <= 0)
            ret.add(Border.LEFT_BORDER_CROSSED);
        else if (sprite.getX() >= getWidth())
            ret.add(Border.RIGHT_BORDER_CROSSED);
        if (sprite.getY() + sprite.getHeight() <= 0)
            ret.add(Border.TOP_BORDER_CROSSED);
        else if (sprite.getY() >= getHeight())
            ret.add(Border.BOTTOM_BORDER_CROSSED);

        return ret;
    }