Pencil Code Reference > jumpxy

 

jumpxy jump by an x y offset without drawing

The turtle starts in the middle of the window, at (x, y) coordinates (0, 0).

jumpxy x, y moves by an xy offset in traditional Cartesian coordinates. In this coordinate system, each unit is one pixel, and each graph paper grid square is 25 units. The mathematical coordinate axes are used, placing (0, 0) at the middle with x increasing to the right and y increasing upward.

A vector represented as an array of two numbers can be used. jumpxy [x, y] is treated the same as jumpxy x, y.

Drawing while Moving

Unlike jumpxy, jumpxy will not trace lines if a pen is being used. jumpxy does not affect the turtle rotation, only its position.

pen peru
jumpxy 50, 50
jumpxy -75, -25
jumpxy 0, -50
jumpxy -125, 100

Limiting Motion

When passing a single location object to jumpxy, it supports an optional second argument limiting the distance of the motion. When the second argument is given, the turtle will move towards the location, but no farther than the limiting distance in pixels.

The following program will move the turtle towards the last mouse event twice per second, but will move no more than 10 pixels each time.

pen green
forever 2, ->
  jumpxy lastmouse, 10

In all these uses, jumpxy moves the turtle without changing its direction (the way it's facing).

Blah blah - let's compare jumpto and jumpxy

jumpto versus jumpxy