tBKwtWS 3 тижнів тому
батько
коміт
2387e58801
1 змінених файлів з 45 додано та 6 видалено
  1. 45 6
      README.md

+ 45 - 6
README.md

@@ -15,7 +15,7 @@ Projects by other students using karel_asset:
 1. Create a new or open an existing **graphics project**
 1. Go to the **Project Files** view by clicking the "**Files**" button in the ribbon on the left
 1. Add the karel_asset.py file by:
-    * Either clicking the CIP icon of a file with a plus sign (+) in it to add a new file and paste the content of [karel_asset.py](https://git.h0v1n8.nl/Stanford/karel_asset/raw/master/karel_asset.py)
+    * Either clicking the CIP icon of a file with a plus sign (+) in it to add a new file and paste the content of [karel_asset.py](https://git.h0v1n8.nl/Stanford/karel_asset/raw/master/karel_asset.py) (The icon willonly appear after letting the mouse hover over the row representing the root project directory bearing the project name)
     * Or by downloading/cloning this project and uploading the karel_asset.py file with the upload button on the CIP IDE
 
 ## Using karel_asset.py when it is added to a CIP project
@@ -66,9 +66,13 @@ To draw a Karel in any colour use the optional argument colour:
 draw_karel(canvas, colour="red", background="#FF8833")
 ```
 Colour names and hex codes are accepted, just like normal for any CIP graphical object.
+In addition it is possible to make use of random colours:
+```
+draw_karel(canvas, colour="random", background="random")
+```
 
 #### Transparancy
-To draw a transparant Karel, which only has outlines and no fill, use the optional argument transparent:
+To draw a transparant Karel, which only has outlines and no fill/body, use the optional argument transparent:
 ```
 draw_karel(canvas, transparent=True)
 ```
@@ -87,7 +91,12 @@ To change the colour of any asset, use recolour_asset(karel, colour, background)
 For example changing a red/blue Karel to a green/yellow Karel:
 ```
 my_karel = draw_karel(canvas, colour="red", background="blue")
-my_karel = recolour_asset(my_karel, colour="green", background="yellow) 
+my_karel = recolour_asset(my_karel, colour="green", background="yellow)
+```
+Random colours are supported:
+```
+my_karel = draw_karel(canvas, colour="random", background="random")
+my_karel = recolour_asset(my_karel, colour="random", background="random)
 ```
 
 ### Changing position relative to current position
@@ -153,6 +162,22 @@ my_karel = draw_karel(canvas, colour="red", background="blue")
 my_karel = rotate_asset(my_karel, "south")
 ```
 
+### Relative resizing
+To resize an asset relative to its current size, use relative_resize_asset(asset, size_difference).
+To schrink an asset by 10 pixels:
+```
+my_karel = draw_karel(canvas, size=100)
+my_kaerl = relative_resize_asset(my_karel, -10)
+```
+
+### Absoulute resizing
+To resize an asset to a new absolute size, use absolute_resize_asset(asset, size).
+To resize an asset to 50 pixels:
+```
+my_karel = draw_karel(canvas, size=100)
+my_karel =  absolute_resize_asset(asset, 50).
+```
+
 ### Erasing an asset
 To remove a Karel from the canvas, use erase_asset(asset):
 ```
@@ -161,16 +186,25 @@ my_karel = erase_asset(my_karel)
 ```
 
 ### Generating a random asset
-To generate a random asset, use generate_random_asset(canvas):
+To generate a random asset, use generate_random_asset(canvas, karel_prevelance:int=3, centre_x="random", centre_y="random", size="random"):
 ```
 my_asset = generate_random_asset(canvas)
 ```
+By default there will be approximately 1 beeper for every two karels, this can be changed with the karel_prevelance argument.
+Draw approximately 50% beepers and 50% Karels:
+```
+my_asset = generate_random_asset(canvas, karel_prevelance:int=2)
+```
+In case the preference is to only have random orientations and colours, optionally the size and or centre_x & centre_y coordiantes can be specified.
+
+### Generating a random asset outside the canvas
 
 ### Generating a random karel
-To draw a Karel with a rondom properties, use generate_random_karel(canvas):
+To draw a Karel with a rondom properties, use generate_random_karel(canvas, centre_x="random", centre_y="random", size="random"):
 ```
 my_karel = generate_random_karel(canvas)
 ```
+Optionally the coordiantes and/or size can be specified.
 
 ### Generating a Karel outside the canvas
 To draw a Karel outside of the canvas, to perhaps be later slid into view, use generate_outofbounds_random_karel(canvas, side):
@@ -178,13 +212,18 @@ To draw a Karel outside of the canvas, to perhaps be later slid into view, use g
 my_karel = generate_outofbounds_random_karel(canvas, "left")
 ```
 
+
+
+
+
 ### Drawing and generating a beeper
 Works the same as drawing and generating a karel, available commands:
 * draw_beeper(canvas, centre_x:int=25, centre_y:int=25, size:int=50, orientation:str="east", colour:str="black", background:str="cyan", transparent:bool=False)
 * generate_random_beeper(canvas)
 * generate_outofbounds_random_beeper(canvas, side:str)
 
-### Generating a random asset
+### Generating a random out of bounds asset
+To draw a Karel outside of the canvas. Possible use is to slide it into the canvas.
 Works the same as drawing and generating a karel, available commands:
 * generate_random_asset(canvas)
 * generate_outofbounds_random_asset(canvas, side:str)