Assignment #3 Functions and Arrays

Although at first, it looks like not much has changed in my sketch, move the mouse and much will happen!

So, thanks to Dustin’s help, I was able to fix the problems i was facing with the eyes that were “exploding” (they are now flickering which makes the dizzy effect). Same thing with the orange spots that didn’t seem to bounce together…well now they do!

I also added a conditional to the green face: each time the mouse button is pressed on the green quadrant, the face slightly moves away until it disappears.

I have 4 faces/quadrants, thus I combined many effects in the same sketch, I’ve got some background color changing randomly, some gravity, conditionals, movement, loops….

Functions…they do make code much shorter….since I had 4 faces that looked similar, now I could use functions that draw the same head but different times, in different places. Still have a long code, but it’s getting shorter the more I learn processing.

After reading the chapters, I usually take some code from an exercise, insert it in my sketch and try to modify it, run it, and if it’s not working, keep looking for the bug until it functions properly. I found that this technique helps lot.

Arrays….Not my favorite chapter…but I did run my sketch with some arrays in there…I worked on a yellow ellipse that follows the mouse and leaves traces of smaller ellipses as the mouse moves…I set my array to have 30 variables, so that there would be 30 small ellipses following. I still believe that I have much to learn about arrays, but I guess it will come with time.

Here’s the sketch:

Oh, and although the sketch was running fine, there seem to be an error, on the bottom it kept saying something about an error, something singular matrix… It started to happen after I added the scale in the yellow ellipse, so the yellow ellipses scale up as the mouse moves around.


Comments are closed.