I am trying to make concentric circle that are clickable and draggable and when you drag one, the child/parent circles drag with. The calculations are simple:
int newsize = (dlvl[l].sizeW-mouseX<0)?0:dlvl[l].sizeW-mouseX;
dlvl[l].update(newsize);
}
}
}
Wherein you just use either mouseX or mouseY of dragging for the circle size. However, I find that the circle either replace eachother or other issues. Can someone tell me what I am doing wrong?
int levels = 3;
float[][] level = new float[levels][5];
Level[] dlvl = new Level[levels];
void mouseDragged(){
for(int l=0;l<levels;l++){
dlvl[l].dragging=true;
}
}
void mousePressed(){
for(int l=0;l<levels;l++){
dlvl[l].selected=true;
}
}
void mouseReleased(){
for(int l=0;l<levels;l++){
dlvl[l].selected=false;
}
}
void setup(){
size(500,500);
initializeLevelData();
initializeLevel();
}
void draw(){
update(mouseX,mouseY);
background(0);
for(int l=0;l<levels;l++){
dlvl[l].display();
}
//update();
}
void initializeLevelData(){
for(int lvl=0;lvl<levels;lvl++){
level[lvl][0] = width/2;
level[lvl][1] = height/2;
level[lvl][2] = 150*(lvl+1);
level[lvl][3] = 150*(lvl+1);
}
}
void initializeLevel(){
for(int l=0;l<levels;l++){
dlvl[l] = new Level((int)level[l][0],(int)level[l][1],(int)level[l][2],(int)level[l][3]);