TurtleGraphics - Online Manual

turtle_move {TurtleGraphics}R Documentation

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_col, turtle_lty, turtle_lwd, turtle_param; turtle_down, turtle_up; turtle_do; turtle_getangle, turtle_getpos; turtle_goto, turtle_setangle, turtle_setpos; turtle_hide, turtle_show; turtle_init; turtle_left, turtle_right, turtle_turn; turtle_reset; turtle_status

Examples

turtle_init()
turtle_left(30)
turtle_forward(2)
turtle_up()
turtle_forward(1)
turtle_down()
turtle_right(60)
turtle_forward(9)

[Package TurtleGraphics version 1.0-5 Index]