Hello! I am having an issue with a program I'm writing in p5.js. The goal is to create a wall of text that gradually disappears unless you click on specific words to keep them there. So far, I have managed to do that, but I haven't found a way to keep the text from overlapping each other. I watched the video on non-overlapping circles but since rectangles don't have a radius but a height and width, using the distance function doesn't work. Furthermore, I would like for all words in the word file to be displayed, so I can't just not display it if it overlaps and draw another one.
I'm hoping someone here could point me in the right direction regarding this, or maybe someone has ideas on what I could try.
here is the code I have so far (the text is in a separate file from the sketch)
Thanks in advance for any help 🙂