this is a very simple question which is confusing me quite a bit since I have done OOP in Java before and never had this issue. Basically when I go to call the class to create the object in question it's just not happening I have no Idea why this won't work, I assuming it might be misuising a bit of processing simplified java.
final color RED = color(255,0,0);
final color BLUE = color(0,0,255);
motorbike bike1;
motorbike bike2;
class motorbike
{
int x = 5;
//members
int y;
int speed=2;
int size=30;
color colour;
void render()
{
float wheelHeight = size/3;
fill(colour);
triangle(x,y,x+size,y,x+size/2,y-size/2);
//built-in triangle routine
drawWheel(x,y,wheelHeight);
drawWheel(x+size,y,wheelHeight);
}
void drawWheel( int x, int y,float size)
{
float inner = size*2/3;
fill(0);
ellipse(x,y,size,size);
fill(255);
ellipse(x,y,inner,inner);
}
void move()
{
speed= (int)random(5.0);
//a random step [0..5]
x=x+speed;
}
void update() {
move();
render();
}
motorbike(int y,color col){
//constructor
this.y=y;
this.speed= (int)random(5.0);
this.colour=col;
}
//endof class description
}
void setup()
{
size(500,100);
bike1 = new motorbike(RED,30);
bike2 = new motorbike(BLUE,60);
print("Come on");
}
void draw()
{
background(125);
}
Sorry for the really dumb question but this should be calling I don't know why it's not drawing the object.