We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › random size of birds
Page Index Toggle Pages: 1
random size of birds (Read 578 times)
random size of birds
Nov 11th, 2007, 7:16pm
 
hej i am working with the birds sketchbook from the learning session. i would like to know how to implement random size of the birds. i allready implemented that the birds take their color from a certain array:

birds[i].setColor(goodcolor[i]);

but i cannot make the size work.

thanks for your help in advance.
Re: random size of birds
Reply #1 - Nov 12th, 2007, 10:55pm
 
be more specific on which example it is please
Specify
Reply #2 - Nov 13th, 2007, 8:51am
 
Hej there Salt and Onion,

i am talking about the Sketchbook in the lerning section:

Learning/3d&OpenGL/Transform/Birds

As i wrote before i am stuck on where to put the parameters so that i can have a 'random'/'different specific' sizes of the birds.

Thanks for your help.
Re: random size of birds
Reply #3 - Nov 13th, 2007, 9:43am
 
Hi. Have a look at the Bird class : the parameters controlling the size of the birds are already specified (w and h : width & height). By default, the Bird() constructor assigns w=60, h=80, by you can specify your own values :

Bird b = new Bird(0, 0, 0, myWidth, myHeight);

Quote:
class Bird{
 // properties
 ...
 float w, h;
 ...
 // constructors
 Bird(){
   this(0, 0, 0, 60, 80);
 }
 Bird(float offsetX, float offsetY, float offsetZ, float w, float h) { ... }
 ...
}
Page Index Toggle Pages: 1