hi,
I would like to use the mousePressed function to create new objects from a class at the location of the mouse. But the class itself seems complicated (I’m working on an example I found). When I type:
void mousePressed(){
Atom w = new Atom();
}
I get the message ‘‘The constructor HC.Atom() is undefined’’
Here’s the class:
class Atom
{
public PVector position,velocity,acceleration;
public int type;
public Atom(int t){
position = new PVector(random(width),random(height));
velocity = new PVector(random(-3,3),random(-3,3));
acceleration = new PVector();
type = t;
}
public void drawAtom()
{
switch(type) {
case WATER: fill(color(0)); break; //Water color
case HYDROPHOBIC: fill(color(255)); break; //oil color
default: fill(color(255)); break;
}
ellipse(position.x,position.y,max(4,R),max(4,R)); // change shape
}
}