# Yo Case

Essay by   •  February 18, 2012  •  Essay  •  339 Words (2 Pages)  •  1,392 Views

## Essay Preview: Yo Case

Report this essay
Page 1 of 2

Last time in class, we had a challenge on expanding the square which I wrote about in my last entry. The second challenge at the end of class was getting the ball to go through the walls and appear in an opposite side. This code is much more complicated than the expanding square challenge clearly because the code is longer and there are more variables. As you can see in the code below, I started off writing setting the variables for the circles that I am going to be creating later on. I first set the variable for circle_x and circle_y as I'll be using this to replace the (x, y) of the ellipse later on. Then, I declared a variable for the speed for circle_x and circle_y, so the speed would be adjustable. Then, I use "void setup () {}" to for the size of the window and the rest of the commands in "void draw () {}". The first line is very common, where you put background () in the "void draw () {}" section so the shape would disappear and reappear, the second line (fill ()) defines the color of the strokeWeight, which is the outer line of the circle. The next line is the circle itself (ellipse (circle_x, circle_y, 50, 50);), as you can see, there are 2 variables inserted in this command. And these variables will change constantly in order to make the circle move. The first 2 numbers of ellipse defines where the circle is located on the window, and the other 2 numbers defines the size of the circle. The next few lines are really basic, and it is involved in the constant change of the circle, where the numbers are added and the circle moves. if (circle_x < 0){ this program tells the circle to bounce.

Overall, the challenge was really difficult first time I tried to do it. However, once I know the basic and the new techniques, I got the hang of it. Which wasn't difficult after all.

...

...