Adding to ArrayList
in
Programming Questions
•
1 year ago
When I run this code, nothing happens when I click... Does the for loop not have enough time to finish? is there another way to do this?
void mouseReleased() {
for (int i=miners.size()-1;i>=0;i--) {
if (dist(mouseX+vx, mouseY, resources[i].x,resources[i].y)<50) {
miners.add(new miner(mouseX+vx, mouseY));
cash-=100;
}
}
}
miners is a list of objects from the class miner and the vx variable is used with translate... and resources is an array of objects from my resource class... Any ideas? thanks
1