expecting LPAREN, found 'mousePressed' help
in
Programming Questions
•
1 year ago
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!
much appreciated!
Copy code
- 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);
- text("Vince Lombardi", width/2,95);
- }
- }
1