> to determine the end positions, taking into consideration
> the character's max size and center alignment, I am
> using:
> endX = random(maxSize / 2, width - maxSize / 2);
> endY = random(maxSize, height);
are you sure these are centre aligned? (ok, they are centre bottom aligned)
wouldn't the endY be somewhere between (height - maxSize) and height? similarly endX would be between (width - maxsize) and width.
unfortunately if you do this all the characters end up on top of each other in the bottom right hand corner. perhaps you actually want them along the bottom OR along the right but not both. in which case you have to treat the two edges differently:
Code:
if (random(10) < 5) {
// random position on right hand edge
endX = width;
endY = random(0, height);
} else {
// random position on bottom edge
endX = random(0, width);
endY = height;
}
(use textAlign(RIGHT) and the bottom right of the letter is the origin. which makes it easier to define the endX and endY as that's also bottom and right)
i think the printing of the current state of the 5000 character array every frame was dragging it down too.
have also found out what was causing it to run out of memory - the maxSize for the font. reducing it to 100 solves the problem.
and you can replace *the whole of* your keyPressed with this:
Code:
void keyPressed() {
updateArray();
updateInit();
charTimer[0] = millis();
charArray[0] = key;
beginX[0] = xPos;
beginY[0] = yPos;
xPos += xInc;
}