Hi all,
I have been working on a project in which I am harvesting questions people type into Google. A cronjob collects the results from Google's "suggest" list into several XML files.
The current state of the project is here:
http://www.oracloud.netHere is the full code:
http://www.oracloud.net/sketch12.pdeThe problem I'm having is with the words bouncing off one another. I have tried just about everything and this is the best result I could get. But I'd really like to eliminate the issue where some of the words get "caught" and sort of jitter near the mouse until I move the mouse to release them. I want it to be possible to hover over one word, while other words get pushed away. When the mouse is still and not hovering over a word, I want to make sure words heading that direction don't get caught. For the most part, this is happening.
Here is the conditional that is essentially causing words to bounce back when the mouse is still.
Code:if (dist(posX[i]+(qWidth/2), posY[i]-(fontsize/2), mouseX, mouseY) < (qWidth/2+25) && abs(mouseX-pmouseX) < 1 && abs(mouseY-pmouseY) < 1) {
dirX[i] *= -1;
dirY[i] *= -1;
}
The main problem is that this is all within a loop that alters each position (posX, posY) array (one per shape). Before I was setting a boolean called hover to true upon hover, and this would cause any subsequently drawn words to bounce back, but then at the end of draw() hover had to be reset to false (so it will be false when a user is not hovering).
I know this is fairly complex territory as it requires understanding my entire program, but if anyone has suggestions how I can improve this mechanism they would be
greatly appreciated.