This might be a naive question, but is there a destructor in Processing.js? I know that regular Processing is Java-based so there isn't a destructor, but I'm not sure if Processing.js runs the same way.
Just so it's here, here's the class I want to build a destructor for, if needed:
// Obstacle Class
class Obstacle {
float r,g,b;
float x, y, w, h;
float speed;
Obstacle(float x_pos, float y_pos, float width, float height, float sp) {
// Initialize Color
r = random(255);
g = random(255);
b = random(255);
// Initial Size
w = width;
h = height;
// Initial Position
x = x_pos;
y = y_pos;
// Initialize Speed
speed = sp;
}
void update() {
y += speed;
}
void draw() {
fill(r,g,b);
rect(x,y,w,h);
}
}