so the first thing i want to do is create a display area in Processing. This is very easy and is accomplished simply by writing.
void setup() {
size(320, 200);
background(255);
}
That does nothing other than create a white area that is 320 pixels by 200 pixels.
void means it returns no result. Its kind of a funny concept. Best understanding of it I have so far is that it just means do this but don't return a value.
http://processing.org/discourse/yabb2/YaBB.pl?num=1114658331/5
Some people discussing it in that forum post, some links to help understand it in there.
setup() is called only once when the program is started and it defines initial properties for the sketch such as the screen size(display area), background colour etc.
size() is pretty self explanatory, it defines the dimensions of the display area in pixels.
background() is the colour of the background, I set it to white so that the blank area is clearly seen.
So I have accomplished my first step, I have an area in which to make my balls bounce!
Result:
No comments:
Post a Comment