Пример #1
0
        //walk is calculated based on selected direction, number of spaces, and pen action (up = no draw, down = to draw)
        public void WalkX(Directions.TurtleDirections direction, int step)
        {
            if (ValidateMove(direction, step))
            {
                switch (direction)
                {
                case Directions.TurtleDirections.NORTH:
                    PositionX -= step;
                    break;

                case Directions.TurtleDirections.SOUTH:
                    TurtleMovementArea.UpdateMovementAreaX(PositionX, step, +1, PositionY);
                    PositionX += step;
                    break;
                }
            }
        }
Пример #2
0
        public void WalkY(Directions.TurtleDirections direction, int step)
        {
            if (ValidateMove(direction, step))
            {
                switch (direction)
                {
                case Directions.TurtleDirections.EAST:
                    TurtleMovementArea.UpdateMovementAreaY(PositionY, step, +1, PositionX);
                    PositionY += step;
                    break;

                case Directions.TurtleDirections.WEST:
                    TurtleMovementArea.UpdateMovementAreaY(PositionY, step, -1, PositionX);
                    PositionY -= step;
                    break;
                }
            }
        }
Пример #3
0
 public TurtleMove()
 {
     _turtle            = new Turtle();
     turtleMovementArea = new TurtleMovementArea();
     _quit = false;
 }