loadStrings() question
in
Programming Questions
•
4 months ago
So I have a text file called list.txt, and it has this in it:
750
500
600
300
1100
550
600
20
899
500
750
350
and I used the loadStrings() function to import it into the file. But I have a problem.
What Im trying to do is use those values for the x and y coordinates for an object I make at the setup.
void setup() {
size(1500, 700, P3D);
// start with one ball
balls.add( new Ball(width/2, 0, 0));
background(0);
}
Where it says Ball(width/2, 0, 0)) Im trying to replace width/2, 0 with two values from the txt file, such as the first two (750, 500). How would I go about doing this?
1