my original sketch, made with global variables, is here
http://openprocessing.org/visuals/?visualID=15890
I've been trying to recreate the same thing with objects. I finally got the sketch to start, except it is a blank, black screen. I've tried passing different arguments to bounce1 = Ball();, but the error messages have stopped being helpful. I'll probably figure it on in a day or few, but i'm getting tired of that kind of workflow :(
If anyone could tell me what's wrong it, I would really appreciate it.
Ball bounce1;
void setup()
{
size(200, 200);
fill(100, 204);
bounce1 = new Ball();
frameRate(30);
colorMode (RGB);
}
void draw()
{
background(0);
bounce1.display();
}
class Ball {
float y, x, radius, speedX, speedY, directionX, directionY;
int ballColor;
Ball() {
float y = 30.0;
float x = 30.0;
float radius = 20.0;
float speedX = 1.0;
float speedY = 1.0;
float directionX = 1;
float directionY = 1;
int ballColor = 150;
}
void display() {
fill(204, 102, 0);
ellipse(x, y, radius, radius);
ellipseMode(CENTER);
stroke(5);
}
};
1