Small Basic Turtle: Comparing Angle and Turn


In Small Basic, we have two different types of methods to turn your Turtle:

 

  • Turtle.Angle – Gets or sets the angle of the turtle. Setting this property turns the turtle to the new angle.
  • Turtle.Turn(angle) – Turns your turtle by an angle (in degrees) from its current direction. If the angle’s positive, the turtle turns to its right (clockwise). If the angle’s negative, your turtle turns to its left (counterclockwise).

 

For example, you’d set the Angle method to a value, like this:

Turtle.Angle = 90

 

That would turn your turtle 90 degrees from pointing up, even if your turtle isn’t facing up! That’s an absolute angle, because it turns the angle according to your XY grid coordinates, regardless of the direction your turtle is facing.

 

Now, let’s look at the relative angle change:  

Turtle.Turn(90)

 

In this case, your turtle turns 90 degrees to his right. So if he’s facing down, he’ll turn to his right and face to our left.

    

Go to http://blogs.msdn.com/SmallBasic to download Small Basic for free and learn all about it!   

   

Please leave a comment with any corrections, suggestions, and questions!

   – Ninja Ed

Comments (3)

  1. Medical Marketing says:

    Impressive article  thank you for sharing ..

  2. You're welcome Medical Marvel!

  3. Computers Today (part 1 of 6)

    blogs.msdn.com/…/computers-today.aspx

    …..

    CS SPOTLIGHT: Girls in computer programming… why it matters!!!

    blogs.msdn.com/…/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx

    Computational Thinking – Videos & Papers by Jeannette Wing

    blogs.msdn.com/…/computational-thinking-videos-amp-papers-by-jeannette-wing.aspx

Skip to main content