소스 검색

+ extra move functions

tBKwtWS 1 개월 전
부모
커밋
07c29e056c
1개의 변경된 파일24개의 추가작업 그리고 0개의 파일을 삭제
  1. 24 0
      README.md

+ 24 - 0
README.md

@@ -100,6 +100,30 @@ my_karel = draw_karel(canvas, colour="red", background="blue")
 my_karel = relative_move_asset(my_karel, 10, -10)
 ```
 
+### Changing position relative to its orientation
+To change the position of an asset on the canvas relative to its current orientation, use orientation_move_asset(asset, direction, amount)
+Directional options:
+* forward
+* front
+* left
+* right
+* backward
+* back
+To move an asset to its right by 10 pixels:
+```
+my_karel = draw_karel(canvas, colour="red", background="blue")
+my_karel = orientation_move_asset(my_karel, "right", 10)
+```
+
+### Changing absolute position on the canvas
+To change the position of an asset on the canvas with absolute coordinates, use absolute_move_asset(asset, x, y).
+Where x is the absolute width centre and y is the absolute height centre.
+To move an asset to 100 by 100:
+```
+my_karel = draw_karel(canvas, colour="red", background="blue")
+my_karel = absolute_move_asset(my_karel, 100, 100)
+```
+
 ### Rotating
 To turn an asset, use rotate_asset(asset, orientation).
 Orientation options: