class Blob { // max velocity float vmax; // max acceleration float amax; // max repulsion speed float rmax; // current x coordinate float x; // current y coordinate float y; // current velocity in the x direction float vX; // current velocity in the y direction float vY; String type; Blob(float X, float Y, String Type) { type = Type; x = X; y = Y; vX = 0; vY = 0; amax = 0.4; rmax = 0.5; if( type == "A") { vmax = 10; } else { vmax = 1; } } void display() { if (type == "A" ) { stroke(200, 255, 128); } else { stroke(0,0,0); } strokeWeight(vmax+1); point(x,y); } void gravitate(float gX, float gY) { float theta = atan((gY-y)/(gX-x)); float aX = abs(gX-x)/(gX-x)*amax*cos(theta)*abs(gX-x)/1000; float aY = abs(gY-y)/(gY-y)*sqrt(pow(amax,2)-pow(aX,2))*abs(gY-y)/1000; vX = aX + vX; vY = aY + vY; truncate(); } void truncate() { } void repulse() { } void move() { x = vX + x; y = vY + y; } }