Freigeben über


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 https://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