Very new to processing - Working with Text

Hi I’m very new to processing and am stuck on how to go about doing what I want. Attached is what i have so far but i’d like to make it so that the “you are here” text remains at one instance while a secondary “here” is added upon every mouse click at random positions, sizes, and depth coordinates. After about 10 additional “here’s” i’d like to make it so that lines of random length, rotation, width and positions are added and continue on until reset; all while here’s are still being added. I know this is very vague and confusing but i’m losing hair over trying to figure this out and the reference section is being very little help haha.

Here’s what I have so far:

void setup(){
  size(700,700);
}

void draw(){
  background(0);
  text("YOU ARE HERE", 350, 350);{
    textAlign(CENTER);
    textSize(40);}
    
  text("HERE")
}

Please format your code using </> in the message editor.

Remember to add ; at the end of every line.

Just changed few things :

int countHere = 0; // counts the number of here

void setup(){
  size(700,700);
  background(0);
  
  textAlign(CENTER);
  textSize(40);
  
  text("YOU ARE HERE", width/2, height/2);
}

void draw(){
}

void mousePressed(){ //Activate the function when the mouse is pressed
  text("HERE",random(width),random(height)); //random(val) gives you a random value between 0 and val
  countHere ++;
}

Since you don’t have to erase background each time, you draw “you are here” in the setup function and set all the text parameters here.
I let you do the other part with lines.

2 Likes

thank you! I was having trouble with entering the random value as I didn’t know how to properly format it. This was a huge help and I can now use it as reference for what I’m ultimately going for.

No problem, have a nice day ! :slight_smile: