HELP please :D

Hello everyone, I have been working with processing and I need help on my project. I think Eiton left for somewhere, right?

Well, I am going to post the code here and perhaps you guys could tell me what’s wrong with it.

part of my CODE (where processing has a problem I will indicate with a *)

PFont font;

float[] x;
float[] y;

float[] speedX;
float[] speedY;

String[] txt;
****txt = {***** (<–they say there is a “unexpected token: {” )
“Half”, “Palestinian,”, “half”, “Jew”,
“What”, “is”, “this”, “world”, “coming”, “to?”,
“How”, “did”, “this”, “become-“,
“How”, “is”, “this”, “real?”,
“Totally”, “two”, “opposites-“,
“How”, “can”, “I”, “feel?”,
“Didn’t”, “know”, “before”,
“Absolutely”, “denied”,
“Became the” “people”, “I”, “least”, “expected”,
“I”, “wish”, “I”, “could”, “hide”,
“My”, “memories”, “resurrected”,
“Others”, “will”, “now”, “think”, “I”, “lied”,
“A”, “part”, “of”, “me”, “has”, “died”,
“Totally”, “two”, “opposites”,
“With”, “a”, “clear”, “divide”,
“Confusion”, “from”, “all”, “sides”, “over”, “takes”, “me”,
“Death”, “on”, “both”, “sides”, “rakes”, “me”,
“Mother”, “you”, “never”, “told”,
“Damn”, “it”, “sometimes”, “I”, “feel”, “so”, “old”,
“But”, “I’m”, “not-“,
“Growing”, “I”, “am”,
“Grown”, “I’ll”, “be”,
“The”, “question”, “is:”, “will”, “this”, “world”, “ever”, “have”,
“a”, “place”, “for”, “me”,
“?”, };

void setup() {
size(600, 600);
font = loadFont(“AgencyFB-Reg-48.vlw”);
textFont(font);
noStroke();
x = new float[txt.length];
y = new float[txt.length];
speedX = new float[txt.length];
speedY = new float[txt.length];

for(int i=0; i<txt.length;i++) {
x[i]=0;
y[i]=0;
speedX[i] = random(1.0);
speedY[i] = random(2.0);

}
}
void draw() {
background(0);
fill(255,255,255);
for(int i=0; i<txt.length;i++) {
x[i]=x[i]+speedX[i];
y[i]=y[i]+speedY[i];
text(txt[i], x[i], y[i]);

if(x[i]>width) {
x[i]=-100;

}
if(y[i]>height) {
y[i]=-100;
}
}
}

ok, Thanks in advance!!!!!

Advertisements

~ by Ilana Alazzeh on May 6, 2008.

5 Responses to “HELP please :D”

  1. When you first declare an array, you either need to fill it right away or declare its size. So either say String[] txt = {“something”, “or”, “other”}; or say String[] txt = nex String[3];

    I used 3 because that’s how big my example was. You’ll probably have the same problem with your other arrays.

  2. Stephanie is right you just have to define the contents of the array on the same line you declare it eg:

    String[] txt = { “Half”, “Palestinian,”, “half”, “Jew”,
    “What”, “is”, “this”, “world”, “coming”, “to?”,
    ….

    (I’m around by the way)

  3. Umm I tried to follow what you said by putting it all on one line like this because I declared it Eitan just like the way you told me to and it didn’t work for me.

    now I am receiving a syntax error about perhaps missing a ;

    String[] txt = { “Half”, “Palestinian,”, “half”, “Jew”, “What”, “is”, “this”, “world”, “coming”, “to?”, “How”, “did”, “this”, “become-“, “How”, “is”, “this”, “real?”, “Totally”, “two”, “opposites-“, “How”, “can”, “I”, “feel?”, “Didn’t”, “know”, “before”, “Absolutely”, “denied”, “Became the” “people”, “I”, “least”, “expected”, “I”, “wish”, “I”, “could”, “hide”, “My”, “memories”, “resurrected”, “Others”, “will”, “now”, “think”, “I”, “lied”, “A”, “part”, “of”, “me”, “has”, “died”, “Totally”, “two”, “opposites”, “With”, “a”, “clear”, “divide”, “Confusion”, “from”, “all”, “sides”, “over”, “takes”, “me”, “Death”, “on”, “both”, “sides”, “rakes”, “me”, “Mother”, “you”, “never”, “told”, “Damn”, “it”, “sometimes”, “I”, “feel”, “so”, “old”, “But”, “I’m”, “not-“, “Growing”, “I”, “am”, “Grown”, “I’ll”, “be”, “The”, “question”, “is:”, “will”, “this”, “world”, “ever”, “have”, “a”, “place”, “for”, “me”, “?” };

  4. ok I fixed it.
    but on my

    void setup() { (i get unexpected token:void)

    :S

  5. ilana, for your last error you probably forgot a braket before your void setup…so it thinks that your setup function is within your previous one. void is a saved word so you cant use it to name things so thats why youre getting that error. hope that helps. Now back to writing my paper T___T

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: