unexpected token :(
in
Programming Questions
•
5 months ago
this is my code and I'm getting an erro. and how can i drage the ellipse in to each
quadrants.please help
this my code
Ball b; // instant of the object
void setup()
{
size(400,400);
background(255);
}
void draw()
{
smooth();
line(0,height/2, width, height/2);
line(width/2,0,width/2,height);
//b.display();
}
void mousePressed()
{
fill(c);
ellipse(ballX,ballY,radius,radius);
}
void mouseReleased()
{
fill(c);
ellipse(ballX,ballY,radius,radius);
}
class Ball
{
//data memebers declarations
int radius;
color c;
//position of the ball
int ballX; //position of the ball on x-axis
int ballY //position of the ball on y-axis
//constructor(data member inialisations)
Ball()
{
radius = 50;
c = color(random(0, 256), random(0, 256), random(0, 256));
ballX = (int) random(radius, width-radius);
ballY = (int) random(radius, height-radius);
}
//method
void display()
{
fill(c);
ellipse(ballX, ballY, radius, radius);
}
}
1