Friday, September 21, 2012

DSDN 142: Learning Functions

So, today in class we learnt all about functions, and how immensely useful they would be in this project. A function essentially lets you create your own little sub-program inside your processing sketch, which you can then loop and do all kinds of crazy things with.

This was a really simple function that I made. The rectangle set at the top is what I used as the base function, and then I made a little loop to make the set in the middle. I allowed for the function to have three variables: x-position, y-position, and width.

So I started looking at how I could incorporate this concept of functions into my next project, and I realised it would be an invaluable asset to my program, since I want to have the ability to create multiple suns as well as create multiple plants that can be created with a range of variables in mind.

The best way of creating multiple suns in Processing though is going to be to use arrays, a skill I have not yet mastered yet, sadly.

No comments:

Post a Comment