Turtle Graphics in Atari BASIC

Prabhudeva Kavi

By adding just a short subroutine to your BASIC programs, you can simulate some turtle graphics commands.

Here is a BASIC subroutine (modified from Charles Brannon's "Turtle Pilot for the Atari/' COMPUTE!, October 1982) that allows you to add turtle graphics to Atari BASIC. Turtle graphics will not affect the BASIC graphics statements in any way, and both turtle and BASIC graphics statements can be used at the same time.

Here are descriptions of how to use turtle graphics.

Turn the turtle:

TURN = X:GOSUB 31010 Turns the turtle clockwise X degrees if X

is positive, and counterclockwise X degrees if X is negative.

Turnto:

TURTA = 90 — X Changes the angle of the turtle to the value of X. North is 0 degrees; south is 180 degrees; east and west are 90 and 270 degrees respectively.

Draw:

LINEL = X: GOSUB 31020 Moves turtle X units in the direction it is facing; leaves a trail.

Move the turtle:

LINEL = X: GOSUB 31060 Like Draw, but doesn't leave a trail. Move to:

TURTX = X:TURTY = Y Moves turtle to X,Y location without leaving a trail. The range of X coordinates is from — 79 to 80; for Y it is — 48 to 47. The origin is at the center of the screen.

Programs 2 and 3 use the subroutines in Program 1. Type in Program 1 and save it. Add each of the other programs to Program 1.

0 0

Post a comment

  • Receive news updates via email from this site