I need some help. I want to make five objects without using a array and I want to assign random values to the class, the random values range is same for all the class objects.
Where can I write the code so that the objects take different values ?
Hi everyone ! I have a question about making classes. Why do you make class and, how can you write procedure within a class to generates and return a single random object ?
Hey Guys I have a question. My professor gave us this example in class
int total; float average; total = 12+25+36+15; average = total / 4; print ("The average is "); print (average);
and the average printed out to 22. However, why did he do float, even is you do int average you get the same answer. Any help will be greatly appreciated.
I am trying to draw random fishes in this aquarium but I am only seeing one fish why ? Please if one can help me out ! Here is the code :
void setup () { size (900,600); background (0) ; // aquarium body stroke (0); fill (255,102); // using alpha transparency rectMode (CENTER); rect (450,320,800,500); // for (int i=1; i<=30; i++) ; { drawFish (int (random (450,370)), int (random (320,400)), int (random (20,65)), int (random (30,60)), int (random (0,2)), int (random (0,255)), int (random (0,255)), int (random (0,255))); } }
void drawFish (int x, int y, int w, int h, int d, int c1, int c2, int c3) {
//body fill (c1,c2,c3) ; ellipse (x,y,w,h);
//direction - odd left, even right if (d%2==0) {
// tail fill (c1,c2,c3); triangle (x-(w/2),y,x-w,y+(h/2),x-w,y-(h/2)); //outer eye fill (255); ellipse(x+(w/4),y-(h/4),8,8); //inner eye fill (0); ellipse (x+(w/4),y-(h/4),4,4) ; }
else {
//tail oppposite side fill (c1,c2,c3); triangle (x+(w/2),y,x+w,y-(h/2),x+w,y+(h/2)); //outer eye opposite side fill (255); ellipse (x-(w/4),y-(h/4),8,8); //inner eye fill (0); ellipse (x-(w/4), y-(h/4),4,4);
Can anyone help me to change direction of this object ? What functions do I need to do to change direction of an object, the object should not move but when you change the values it changes direction left to right. Should I be using the "if" function ?
Any help would be appreciated.
void setup () {
size (250,250);
}
void draw (){ fill (144,144,144) ; ellipse (75,75,55,35); triangle (47.5,75,27.5,55,27.5,95); fill (255); ellipse(86,65,8,8); fill (0); ellipse (86,65,4,4) ;
I am a first year computer science student and, currently I am looking for a processing tutor. Anyone who can teach me processing once or twice a week. I am located in Ottawa Canada.
I am new at processing. I was wondering if anyone here can teach me how to do loops and what is the difference between for loop and while loop ?. I do not get them, any help will be appreciated.