浏览代码

+ rotation

tBKwtWS 17 小时之前
父节点
当前提交
30e69c48c8
共有 1 个文件被更改,包括 27 次插入3 次删除
  1. 27 3
      README.md

+ 27 - 3
README.md

@@ -86,12 +86,12 @@ my_karel = recolour_karel(my_karel, colour="green", background="yellow)
 ```
 
 ### Changing position
-To change the position of a Karel on the canvas, use move_karel(karel, dx, dy).
-Where dx is the amout of pixels shifted horizontally, and dy is the amount of pixels shifted vertically.
+To change the position of a Karel on the canvas, use move_karel(karel, x, y).
+Where x is the amout of pixels shifted horizontally, and y is the amount of pixels shifted vertically.
 To move a Karel up 10 pixes:
 ```
 my_karel = draw_karel(canvas, colour="red", background="blue")
-my_karel = move_karel(my_karel, dy=-10,)
+my_karel = move_karel(my_karel, y=-10)
 ```
 
 To move a Karel down 10 and left 10 pixels:
@@ -100,6 +100,30 @@ my_karel = draw_karel(canvas, colour="red", background="blue")
 my_karel = move_karel(my_karel, 10, -10)
 ```
 
+### Rotating Karel
+To turn karel, use rotate_karel(karel, orientation).
+Orientation options:
+* "right"
+* "left"
+* "east"
+* "east-flipped"
+* "north"
+* "north-flipped"
+* "west"
+* "west-flipped"
+* "south"
+* "south-flipped"
+To turn a Karel to the right:
+```
+my_karel = draw_karel(canvas, colour="red", background="blue")
+my_karel = rotate_karel(my_karel, "right")
+```
+To turn a Akrel toward the south:
+```
+my_karel = draw_karel(canvas, colour="red", background="blue")
+my_karel = rotate_karel(my_karel, "south")
+```
+
 ### Erasing a Karel
 To remove a Karel from the canvas, use erase_karel(karel):
 ```