Please Help me for Text Function ! I am noob

Hi everyone I am A beginner. I wrote this code so far. And I want make output texts in way so that it is has only 5 column inside the screen and when the output is bigger than width it goes to new line under the previous line. I know I have use a loop function in order to make it work.

my output text is only single digit

So show us your code

I want to make the output look like this.

So how can I change the text function and make such loop so that it can look like the attached picture.
here is my code:

Every step increase x by 40 or so

When x>width-40 put x back to 10 or so and increase y by 27 or so

1 Like

I already tried that. Besides it should not happen because the x will never be greater than width it will always starts from 30.
As an example even if you enter that want 25 numbers that starting point of x will be 30.

My advice is still valid.

  • The x moves right and at the end of the line you increase y and set x back to 30.

You have to adjust the values like 30 or 40 of course.

(From what I saw, your } was to soon in the code by the way.)

Chrisir

Here is what I mean with x and y:



int x=30, y=50; 

void setup() {
  size(1000, 1000);
  textSize(40);
  background(170);
  frameRate(33);
}

void draw() {  
  text( "A", x, y);

  x += 70; // move right 

  if (x>width-110) {
    // new line !!!
    x=30; 
    y += 50;
  } // if
}
//