Procházet zdrojové kódy

+ extra move functions

tBKwtWS před 1 měsícem
rodič
revize
07c29e056c
1 změnil soubory, kde provedl 24 přidání a 0 odebrání
  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: