Sunday, 18 April 2010

Processing Sketch - Final Touches

Now that I had the code that would get the data I wanted and the code for the balls I had to do was setup the draw function and create the balls. Unfortunately I could not work out a way to get the balls to bounce off one another and neither could I find out how to use a number to generate objects randomly so I had to create the balls manually as such:

ball1 = new Ball(LT1_Hum);
ball2 = new Ball(LT1_Temp);
ball3 = new Ball(LT2_Hum);
ball4 = new Ball(LT2_Temp);
ball5 = new Ball(LT3_Hum);
ball6 = new Ball(LT3_Temp);
ball7 = new Ball(AtriumA3rd_Temp);
ball8 = new Ball(AtriumA5th_Temp);


And once that was done I entered the float name into the brackets and if you remember from an earlier post the number in the brackets would be the radius.

And here is my draw function that displays the balls:

void draw() {
background(255);
ball1.move();
ball2.move();
ball3.move();
ball4.move();
ball5.move();
ball6.move();
ball7.move();
ball8.move();
ball1.display();
ball2.display();
ball3.display();
ball4.display();
ball5.display();
ball6.display();
ball7.display();
ball8.display();
}


That is it, that is how my processing sketch was made. I will evaluate it properly at some point in the future.

No comments:

Post a Comment