I have a project, in processing, where I want to scrape twitter tweets, then create a flock of boids based on the words of the tweets. Using the flocking example here as base: https://processing.org/examples/flocking.html, I have about 95% of the project done.
The problem now is I want to alter the flocking code so that instead of 1 generic shape (in the example code it was triangles) I want to use the text() function to draw the words of the tweets. Well currently when I do that I get the words stacked on top of each other. Here is the code I'm using:
void render() {
float theta = velocity.heading() + radians(0);
fill(255, 255, 255);
stroke(255);
pushMatrix();
translate(location.x, location.y);
for (int i = 0; i < words1.length; i++) {
rotate(theta);
text(words1[i], 0, 0);
}
popMatrix();
}
From my testing the appears the problem is in the translate portion of the code. location.x and location.y are the current location of the boids this works fine for a single shape, but if I have to track multiple different shapes this might be a problem. Any ideas how to do this without having to rewrite the boids code to run separately for each word of the tweet?