Link: https://editor.p5js.org/valerynfang/sketches/5htpkQDd0
- For this mini project, I used the push() and pop() function to ensure that only those lines of code within the push() and pop() gets the specific functions set on them. For example, if I use the function fill() to make the color of it blue the other codes outside of push() and pop() remains the same. The function translate() allows the whole code below it to move to a specific location without having to change the codes. For example I could change the position of my imaginary creature to a different position without having to change the position of each code one by one. In my code, I used translate to move the creature from one end to another.
- User defined function allows for the set of code to be repeated without having to rewrite the whole code. It allows the code to look more simple and readable. Not only that, user defined function allows the block of code to be repeated using different values so the code would be a lot shorter.
- I used position x, position y, height and width as parameters for the user defined function. These parameters are used to set the positions and size of a rectangle for the arms.
- The user defined functions allowed me to just call the function instead of rewriting the whole code over and over.