Little Turtle Extended Commands

Introduction

There are extended commands in Little Turtle for older students.

The XY and/or Bearing commands are for students that are learning about coordinate systems, angles, ...

Enable the Extended Commands

The extended commands are disabled in Little Turtle. There are two ways to enable them.

1. To permanently enable them, modify the code in turtle.js. Change the following flags (variables).
allowXYs → true
allowCircles → true
allowBearings → true

To disable the Left/Right and Move commands

allowMoves → false
allowDirections → false

2. To temporarily enable the commands, add one or more parameters to the URL. http://server/turtle.html?xy&bearing&circle Note: This does not disable any of the other commands.

Bearing Command

The bearing command is a replacement for the Left/Right commands. It sets the direction the sprite is pointed. It is used with the move command to move the sprite in a specific direction.

In Little Turtle, a bearing is a clockwise angle measured from a ray pointing directly up.

Note: Technically it is not a bearing; its an azimuth. I call it a bearing anyway.

Command Example B 128

Bearing Angle (Direction)
image missing

XY Command

The XY commands moves the sprite to the X,Y coordinates. It is a combination of (replacement for) the Left/Right/Move/Bearing commands.

Note:
- coordinates are pixels (integers)
- If the pen is down a line will be drawn from the original position to the new position.
- The command does not change the direction the sprite's is pointing.
- It might be best to not display the sprite when executing XY commands. The direction the sprint is pointing could be confusing.

Command Example XY 100 100

Coordinate System
image missing

Circle Command

The circle command draws a complete or half circle.

Note: The pen must be down for the circle to be visible. No error is generated if the pen is up.

Command Example CF 30 <- draw full circle of radius 30 pixels
CH 25 <- draw half circle of radius 25 pixels

Drawing Example
image missing