TurtleGraphics (version 1.0-8)

turtle_move: Move the Turtle Forward or Backward

Description

turtle_forward moves the Turtle in forward direction and turtle_backward moves the Turtle back.

Usage

turtle_move(distance, direction = c("forward", "backward"))

turtle_forward(distance)

turtle_backward(distance)

Arguments

distance

single numeric value; specifies the distance to make. Negative distance results in moving in the opposite direction.

direction

character string; moving direction. One of "forward" or "backward".

Details

The Turtle must be initialized prior to using these functions, see turtle_init.

These functions make use of the Turtle's display options specified by the turtle_param function (or if not, use the default options set by turtle_init).

Note that if turtle_up or turtle_down was called, the Turtle's trace will be or not be drawn, respectively.

If you are willing to call these functions in an R loop, you may want to hide the Turtle temporarily (see turtle_hide and turtle_do) before making actual moves. This will increase the drawing performance significantly.

See Also

Other TurtleGraphics: TurtleGraphics-package, turtle_do, turtle_getpos, turtle_goto, turtle_init, turtle_param, turtle_reset, turtle_show, turtle_status, turtle_turn, turtle_up

Examples

Run this code
# NOT RUN {
turtle_init()
turtle_left(30)
turtle_forward(2)
turtle_up()
turtle_forward(1)
turtle_down()
turtle_right(60)
turtle_forward(9)

# }

Run the code above in your browser using DataCamp Workspace