A game where there are circles and you press on them and they dissapear in processing

I need help, could someone give me code for processing not j5.js for a game that has circles where you press on them and they dissapear please. I really need an example asap and it would be amazing if you could give me one. Thank you :slight_smile:

1 Like

You need an ArrayList for that.
KevinWorkman has a really good blog with a lot of tutorials.
Just study this one, and adapt it to your need.

Could you please send me the code though please.

1 Like

Please show your attempt

It is policy not to give full code solutions

I am sorry!

Here is an example





//------------------------------------------------------------------------------------

void setup() {
  size(600, 600);
  background(255);// white
  textSize(25);
  fill(255, 0, 0);
}

void draw() {
  background(255);// white

  text("O", 33, 44); 
  text("O", 133, 144);
  text("O", 233, 44);
  text("O", 233, 444);
}

Studio.ProcessingTogether.com/sp/pad/export/ro.9NGjx94YMTtlu

Sorry, here is my attempt:

void setup() {
size(500,800);
background(0,0,0);

}
void draw() {

  if (mousePressed == true) {
  background(0,0,0);
}
}


void keyPressed() {
  if (key == CODED) {
    if (keyCode == UP) {
     
ellipse(random(500),random(800),100,100);      
fill(216,191,216);
ellipse(250,500,100,100);
    } 
    
  }
}

Its pretty bad but I tried my best

You have to study the ArrayList.
Even a working code is given above.