Hello, I've written a program (or have attempted to) that types out random quotes in my bank of quotes below. Can anyone tell me what might be causing the "expecting LPAREN, found 'mousePressed' " error?
much appreciated!
PFont f;
void setup() {
size(400,200);
f = createFont("Arial",16,true);
}
void draw() {
background(255);
textFont(f);
fill(0);
textAlign(CENTER);
text("A Collection of Inspirational Quotes",width/2,80);
if mousePressed() {
int r = (int)random(8);
if(r==0){
text("Try not to become a man of success but a man of value.",width/2,80);
text("Albert Einstein", width/2,95);
}
else if(r==1){
text("Inspiration and genius--one and the same.",width/2,80);
text("Victor Hugo", width/2,95);
}
else if(r==2){
text("Every artist was first an amateur.",width/2,80);
text("Ralph Waldo Emerson", width/2,95);
}
else if(r==3){
text("No great man ever complains of want of opportunities.",width/2,80);
text("Ralph Waldo Emerson", width/2,95);
}
else if(r==4){
text("The power of imagination makes us infinite.",width/2,80);
text("John Muir", width/2,95);
}
else if(r==5){
text("You miss 100% of the shots you don't take.",width/2,80);
text("Wayne Gretzky", width/2,95);
}
else if(r==6){
text("It always seems impossible until it's done.",width/2,80);
text("Nelson Mandela", width/2,95);
}
else if(r==7){
text("An ounce of practice is worth more than tons of preaching.",width/2,80);
text("Gandhi", width/2,95);
}
else if(r==8){
text("Winning is habit. Unfortunately, so is losing.",width/2,80);
Does anyone know why I can't get the bullet coming from megaman's arm to continue going after i left go of the mouse button? I tried using mouseclicked() but it only showed the bullet at the starting point and it would soon after disappear. Also, Is there a way to keep sending out bullets? At the moment, I can only shoot once per run and every time i press down on the mouse button, it shows the bullet where i let go of the mouse button. Any tips? Thanks in advance for your help!