Hey I wanted to make fish class and the bubbles should be part of the fish. and the bubbles should come out of the fish mouth. but they are giving me error when i try to run the programme. I am unable to figure out the solution to this problem. can any body help me correcting the code please and how to make the bubbles class work and the bubbles come out of each fish mouth. the size of the bubbles array is 5 means each fish should only emit 5 bubbles.
is there anything that can be done about it.
i hope i can get an answer soon.. thanks
int TANK_LEFT;
int TANK_RIGHT;
int TANK_TOP;
int TANK_BOTTOM;
int WATER_TOP;
/*The Fish class holds all the info pertinent to a single
fish: location, size, direction, colour, and speed.*/
class Bubble{
int x,y,w,h;
Bubble (int b1, int b2, int b3, int b4){
x = b1;
y = b2;
w = b3;
h = b4;
}
}
Fish[] f;
class Fish{ // Be consistent in your naming conventions!
int x,y,w,h,dir,r,g,b;
float speed,boost;
Bubble[] bub; // Don't forget to init it: give it a size and set each member in a loop
i am trying to make a bounce class an instance veriable of the ball class but im getting the error
can someone help me that how to make the bounce array a instance veriable of the ball array. i am having difficulty making it
or can someone tell me how to associate one array as an instance veriable of another array. the format will stay the same.
thanks
Bounce[] bnce;
class Bounce{
int x,y,w,h;
Bounce (int b1, int b2, int b3, int b4){
x = b1;
y = b2;
w = b3;
h = b4;
}
}
ball[] f;
class ball{
int x,y,w,h,dir,r,g,b,Bounce[];
float speed,boost;
ball(int p1,int p2,int p3,int p4,int p5,int p6,int p7,int p8,float p9){
x = p1;
y = p2;
w = p3;
h = p4;
dir = p5;
r = p6;
g = p7;
b = p8;
speed = p9;
boost = 0; //initially zero
bnce[i] ;
}
I have the following class code, i want to make this 5 fish, bus its not working. the random values i put in this dont take it for all 5 fish in the class.
i wanted to make the fish turn around as well but it is not turning anyway// like after reflecting the fish is suppose to change the direction. but it is not.. kindly help me out in solving this matter.
Fish myFish , mineFish , hisFish , herFish , goodFish;
class Fish {
int x , y , w , h , r , b , g , s ;
float d , a ,f ;
Fish ( int p1, int p2, int p3, int p4 ,float p5, int p6, int p7 , int p8, int p9, float p10, float p11){
x = p1;
y = p2;
w = p3;
h = p4;
d = p5;
r = p6;
g = p7;
b = p8;
s = p9;
a = p10;
f = p11;
}
}
//useful constants for Assigment 2
final int TANK_LEFT = 100;
final int TANK_RIGHT = 900;
final int WATER_TOP = 300;
final int WATER_BOTTOM = 700;
/*The setup method is the backbone of this program, it
calls 3 drawing procedures in a back-to-front order*/
void setup() {
size(1000, 800);
//random size
int randw = (int)random(30, 50);
int randh = (int)random(randw-20, randw);
//random direction
int randD = (int)random(0, 1); //will be either 0 or 1