📜  Logo-Turtle World

📅  最后修改于: 2020-11-03 07:25:27             🧑  作者: Mango


徽标还有许多其他附加的绘制命令,下面给出其中一些命令。

  • 明文或ct
  • 标签
  • 塞西

label命令将单个单词作为带引号的字符串(例如,“ a_string”)或不带引号的在[]括号中的单词列表(例如,[字母字符串]),并将它们打印在图形窗口中的Turtle位置。让我们考虑以下代码。

指挥官

setxy命令采用两个参数,将第一个作为横坐标(水平轴)的值,将第二个作为纵坐标(垂直轴)的值。它将乌龟放置在这些坐标上,可能会在到达这些坐标时留下墨迹。在以下三个图中,我们显示了如何使用setxy命令。

图1

图2

图3

cleartext命令(缩写为ct )清除命令窗口的文本区域。

明文命令

行使

下面是一个练习,以检查您是否熟悉本章到目前为止所学的知识。

以下命令序列产生什么样的图形?

cs pu setxy -60 60 pd home rt 45 fd 85 lt 135 fd 120

从左到右阅读这些命令,以对其进行解释。尝试找出结果。

以下是命令摘要表。

Command Name Purpose
setx 100

Sets the turtle’s x-coordinate to +100

Moves it 100 points to the right of center

No vertical change

setx -200

Moves the turtle 200 points to the left of center

No vertical change

sety 150

Sets the turtle’s y-coordinate to 150

Moves it 150 points above center

No horizontal change

sety – 50

Moves the turtle 50 points below center

No horizontal change

setxy 100 100

Moves the turtle to xy coordinate 100 100

show xcor

show ycor

Reports the turtle’s x-coordinate

Reports the turtle’s y-coordinate

setheading 0

seth 0

Points the turtle straight up, “high noon”

seth 120

Moves the turtle 120 degree to point to the four o’clock position

以下屏幕截图是上述命令中的一部分的实际演示。

实用演示