Ejemplo n.º 1
0
        public bool directionFree(float x, float y, ACharacter.EOrientation ort)
        {
            switch (ort)
            {
            case ACharacter.EOrientation.LEFT:
                return(!pixelIsWall(x - 5, y) &&
                       !pixelIsWall(x - 5, y - 3) &&
                       !pixelIsWall(x - 5, y + 3));

            case ACharacter.EOrientation.RIGHT:
                return(!pixelIsWall(x + 5, y) &&
                       !pixelIsWall(x + 5, y + 3) &&
                       !pixelIsWall(x + 5, y - 3));

            case ACharacter.EOrientation.UP:
                return(!pixelIsWall(x, y - 5) &&
                       !pixelIsWall(x - 3, y - 5) &&
                       !pixelIsWall(x + 3, y - 5));

            case ACharacter.EOrientation.DOWN:
                return(!pixelIsWall(x, y + 5) &&
                       !pixelIsWall(x + 3, y + 5) &&
                       !pixelIsWall(x - 3, y + 5));

            default:
                break;
            }
            return(false);
        }
Ejemplo n.º 2
0
        internal bool intersection(float x, float y, ACharacter.EOrientation ort)
        {
            int i = 0;

            if (!pixelIsWall(x - 5, y) &&
                !pixelIsWall(x - 5, y - 3) &&
                !pixelIsWall(x - 5, y + 3))
            {
                i++;
            }

            if (!pixelIsWall(x + 5, y) &&
                !pixelIsWall(x + 5, y + 3) &&
                !pixelIsWall(x + 5, y - 3))
            {
                i++;
            }

            if (!pixelIsWall(x, y - 5) &&
                !pixelIsWall(x - 3, y - 5) &&
                !pixelIsWall(x + 3, y - 5))
            {
                i++;
            }

            if (!pixelIsWall(x, y + 5) &&
                !pixelIsWall(x + 3, y + 5) &&
                !pixelIsWall(x - 3, y + 5))
            {
                i++;
            }
            return(i > 2);
        }