Hi all,
I'm trying to make a little bit of code where I read values from two arrays. My aim is to concatenate values from each array into a string and then print the value to the applet window. In the applet window I want the text to appear to be continually changing. I'm hitting a bit of trouble. I keep getting a message saying that the compiler Can't convert object to String. Can anyone tell me how to combine objects in this way in processing? My code is below. Thanks for reading.
I'm trying to make a little bit of code where I read values from two arrays. My aim is to concatenate values from each array into a string and then print the value to the applet window. In the applet window I want the text to appear to be continually changing. I'm hitting a bit of trouble. I keep getting a message saying that the compiler Can't convert object to String. Can anyone tell me how to combine objects in this way in processing? My code is below. Thanks for reading.
- String[] wordOne = {"some", "people", "love", "you"};
String[] wordTwo = {"Can", "you", "smell", "cheese"};
int stepper = 0;
void setup()
{
size(700, 200);
smooth();
PFont font = loadFont("Arial-Black-20.vlw");
frameRate(1);
}
void draw()
{
background(0);
String first = wordOne[stepper];
String sec = wordTwo[stepper];
String fin = concat(first, sec);
textSize(20);
textAlign(LEFT);
text(fin, 20, 100);
stepper++;
if(stepper>3)
{
stepper = 0;
}
}
1