乌龟位置的变量
Variable for location of turtle
我正在尝试在 python 中使用 turtle 制作游戏。我正在尝试编写某种碰撞代码。我最初的想法是让一个变量作为海龟的位置,例如,如果海龟 1 的 location/coordinates 等于海龟 2 的 location/coordinates ,则游戏结束。所以通俗地说我想知道有没有办法把乌龟的位置变成一个变量
使用pos
方法或定义的其他方法here获取乌龟的位置。
pos
returns 作为 Vec2D
向量的位置。 xcor
and ycor
return 乌龟当前的x和y坐标为float
.
我正在尝试在 python 中使用 turtle 制作游戏。我正在尝试编写某种碰撞代码。我最初的想法是让一个变量作为海龟的位置,例如,如果海龟 1 的 location/coordinates 等于海龟 2 的 location/coordinates ,则游戏结束。所以通俗地说我想知道有没有办法把乌龟的位置变成一个变量
使用pos
方法或定义的其他方法here获取乌龟的位置。
pos
returns 作为 Vec2D
向量的位置。 xcor
and ycor
return 乌龟当前的x和y坐标为float
.