Advanced Programming Page

Processing

On March 31, 2015, we worked on Processing which is similar to Java.

Smiley Face

The first thing we did was to make a smiley face. This is my smiley face.



I also made an embedded version of the smiley face.



This is the code for the smiley face.



In the picture above, the numbers represents position. For example, the "fill()" is to change color, the numbers are from the RGB scale.
For the rect, triangle, and ellipse, the numbers are the size and position.

House

After we made the smiley face, we had the challenge to make a house. This is my house.



This is the embedded version of the house!



Here is the code for the house that I have made.



In the picture above, the numbers represents position. For example, the "fill()" is to change color, the numbers are from the RGB scale.
Some examples of this is the sun, the sky, the door, and many more.
For the rect, triangle, and ellipse, the numbers are the size and position.
Some examples of this are the roof, the doorknob, basically everything.

Bouncing Ball

After making the house, we made a bouncing ball. Here is the bouncing ball.



Here is the code for the bouncing ball.



Classes

On April 1, 2015, we learned about Classes.
A class is like instructions for building an item.
We had to make a class of balls. Instead of copying and pasting the code to get more then two balls, we made a class.
These are my bouncing balls.



This is the code for the balls.



In the code above, the first line of code (Not the notes) is a list.
What is does is that it makes how many amount of balls I want it to make.
In the code the number is 50.

The word "void" means that there it is a function.




From the picture, the ones highlighted in green are the color functions.
The codes with the random() are random commands, so it chooses a random number between the number I give it.

One problems I came across was when we had to make than one ball.
How I fixed this was by looking at other classmates' codes and check what I did wrong.
What I forgot to do was to put a semi-colon.

Another error I came across was when making the random color code.
The mistake I made was I accidentally put parentheses that I did not need.

Home