Assignment 4: Text

Inspiration:

I was inspired by the chorus of Halsey’s “Could have been me”(https://www.youtube.com/watch?v=fowcj6Swn84) song which follows this:

I wanna taste love
I wanna feel pride and shame
I don’t wanna take my time
I don’t wanna waste one night
I wanna live better days

I decided to play around with lyrics and randomly generate endings for the phrases “I wanna…” and “I don’t wanna…”

So the lyrics will be generated in this form:

I wanna VERB1 WORD1

I don’t wanna VERB2 WORD2

Code

When the user clicks on the mouse, either phrase with “I wanna” or “I don’t wanna” randomly appears on the screen. The code for that is:

function mouseClicked() {
  let randnumber=int(random(1,3));
  if (randnumber==1){
    text(message,mouseX,mouseY);
  }
  else if(randnumber==2){
    text(message2,mouseX,mouseY);
  }

My CSV file has this list of words:

feel,love,cross,door
dream,future,waste,night
live,happiness,close,Disney
see,sunshine,limit,life
win,butterfly,hate,sky

Code to access each of the words and randomly generate the phrase:

strings = loadStrings("words.csv");
let singleRow=[];


  message = "I wanna " ;
  singleRow = split(strings[int (random(strings.length))], ',');
  message += singleRow[VERB1];
  message+=" ";
  singleRow = split(strings[int (random(strings.length))], ',');
  message += singleRow[WORD1];

Future improvements

This was a great way to learn important components for the midterm game program, as users need instructions. I think that taking data from global dictionaries or common lists would produce interesting results.  Also, playing around with the text on the screen will be so sophisticated upgrade. For example, letters move when the mouse hovers the word, changes the color, or adds other effects.

 

One thought on “Assignment 4: Text”

  1. Nice! You could play with the typography to make it stronger, for example by changing the sizes of some of the words or changing the colours between the “I wanna” and “I don’t wanna” phrases to make them more distinct from each. There’s an additive / painting quality to the clicking that you could enhance to let the user make a kind of visual composition. Also I think it would feel better to have the phrase centered at the mouse click point. You can get the width of the text using textWidth https://p5js.org/reference/#/p5/textWidth

Leave a Reply