Beginner Help for Project (text to coords)

I am new to Processing and coding in general but I have a project I'm trying to start and just need to someone to point me in the right direction. I want to write a sketch that when running will allow me to type a sentence into a text box and then the program will convert each letter into a number (based on the integers I have assigned to the letters beforehand) and as they are typed it will turn them into points on a graph (i.e. typing "Hi" will produce a point at 8,9) and then connect however many points are generated into a line graph.


  • Hey, that sounds like a great sketch! You should try writing it. That way we'll know what you can do yourself, and will be able to easily see what you need help with.

    Chances are good you'll need to use setup(), draw(), background(), text(), keyPressed(), String, ellipse(), line, Array, and int. Maybe color too. You can read about those in the Reference if you need to know more about them.

    Super amazing protip: Start SIMPLE and make things work a LITTLE at a time.

    Can you make a blank sketch? Can you detect a keyPress? Can you record the letter of the key pressed? Can you display the current letters? And so on...

  • edited December 2015

    To achieve what you want besides the basic staff, you'll need:

    1. "type a sentence into a text box" - the easiest way is to use a GUI library, G4P will do.

    2. "convert each letter into a number (based on the integers I have assigned to the letters beforehand)" - when you have any data bindings, it is better to have them separately from your code, so you can create a .csv file and load it into your program using loadTable()

    3. "points on a graph" - you can use a point()!

    4. "connect however many points are generated into a line graph" - as mentioned, you'll need line().

    Post any code that you're able to create to get more help!

    1. you can also use

      switch(key){ case ENTER: writeAsPoints(); break; default: textMy += key; }

    2. int pointNumber = 65-int(key);

    when the first letter is a x position of the point and the 2nd a y pos you need something like

         pointNumberX = 65-int(key); 
         pointNumberY = 65-int(key); 
Sign In or Register to comment.