Hello every one
Iam developing a simple game in processing using java
I am getting an error in my code saying "unexpected token: void" this is in the void setup() part
Can you please:-
1) Help me find the problem and help me solve it.
2) What does unexpected token mean
Here is my code. Additional code as been kept for your batter understanding. But this is not the full code. If you need it please feel free to ask me.
part 1) Is the starting part were some declarations is made
Part 2) Is were i created a class and method. This is where some of the action in the game will take place.
Part 3) The problem according to processing is here. According to it "void setup()" is the problem and it says "unexpected token: void"
1)------------------------------------------------------------------------------------
import TUIO.*;
TuioProcessing tuioClient;
TuioObject tobj;
int LocationX=tobj.getScreenX(width);
int LocationY=tobj.getScreenY(height);
HashMap Questions=new HashMap();
HashMap Answers1=new HashMap();
HashMap Answers2=new HashMap();
HashMap Answers3=new HashMap();
HashMap Answers=new HashMap();
HashMap Facts=new HashMap();
HashMap Clues=new HashMap();
HashMap Failed=new HashMap();
HashMap Ultras=new HashMap();
HashMap PopAndNot=new HashMap();
HashMap Music=new HashMap();
HashMap Voices=new HashMap();
HashMap Positions=new HashMap();
HashMap Visible=new HashMap();
PImage BackgroundImage;
PImage Popups;
PImage Popups2;
Popups = loadImage("popupQ.jpg");
public class Questions
{
int m = 1;
int c = 1;
int f = 1;
String Mu;
String clue;
String failed;
float r;
String q;
String a;
String aa;
String aaa;
String as;
String f;
void Action()
{
Popups2 = loadImage("popupQ.jpg");
image(Popups2, 0, 0);
while (currentState < 20);
{
while (m < 20);
{
while (c < 20);
{
while (f < 20);
{
Mu = Music.get(m);
Mu.trigger();
clue = Clues.get(c);
failed = Clues.get(f);
r = random(1,50);
q = Questions.get(r);
a = Answers1.get(r);
aa = Answers2.get(r);
aaa = Answers3.get(r);
as = Answers.get(r);
f = Facts.get(r);
text(f, 90,90);
text(q, 60,60);
text(a, 30,0);
text(aa, 40,0);
text(aaa, 50,60);
if(id==0 && LocationX >=15 && LocationX<=32 && LocationY>=12 && LocationY<14)
{
selectAnswer = a;
}
if(id==0 && LocationX >=17 && LocationX<=33 && LocationY>=13 && LocationY<16)
{
selectAnswer = aa;
}
if(id==0 && LocationX >=12 && LocationX<=34 && LocationY>=14 && LocationY<17)
{
selectAnswer = aaa;
}
if(as == selectAnswer)
{
text.remove();
text(clue, 50,50);
text("Next", 30,30);
if (id==0 && x >=15 && x<=32 && y>=12 && y<14)
{
currentState++;
m++;
c++;
f++;
}
}
else
{
image(Popups2, 0, 0);
Sad.trigger();
text(failed, 50,50);
text("Next", 30,30);
if (id==1 && x >=15 && x<=32 && y>=12 && y<14)
{
Questions();
}
}
}
}
}
}
}
}
void setup()
{
size(6240,4710);
tuioClient = new TuioProcessing(this);
frameRate(30);
BackgroundImage = loadImage("Map.jpg");
int currentState=0;
Questions.put(1, "What is the next prime number after 7?");
Questions.put(2, "65 – 43");
Questions.put(3, "What is the largest type of ‘big cat’ in the world?");
Questions.put(4, "True or false? Bats are mammals.");
Questions.put(5, "What is the fastest land animal in the world?");
Answers1.put(1, "11");
Answers1.put(2, "22");
Answers1.put(3, "Cheetah");
Answers1.put(4, "Answers1");
Answers1.put(5, "Horse");
Answers2.put(1, "13");
Answers2.put(2, "21");
Answers2.put(3, "Lion");
Answers2.put(4, "Answers2");
Answers2.put(5, "Cheetah");
Answers3.put(1, "15");
Answers3.put(2, "23");
Answers3.put(3, "Tiger");
Answers3.put(4, "Answers3");
Answers3.put(5, "Rhino");
Answers.put(1, "11");
Answers.put(2, "21");
Answers.put(3, "Tiger");
Answers.put(4, "Answers2");
Answers.put(5, "Rhino");
Facts.put(1, "Facts1");
Facts.put(2, "Facts2");
Facts.put(3, "Facts3");
Facts.put(4, "Facts4");
Facts.put(5, "Facts5");
Clues.put(1, "Clue 1");
Clues.put(2, "Clue 2");
Clues.put(3, "Clue 3");
Clues.put(4, "Clue 4");
Clues.put(5, "Clue 5");
Failed.put(1, "failed 1");
Failed.put(2, "failed 2");
Failed.put(3, "failed 3");
Failed.put(4, "failed 4");
Failed.put(5, "failed 5");
Music.put(1, minim.loadSample("Black Water.mp3"));
Music.put(2, minim.loadSample("byrd.mp3"));
Music.put(3, minim.loadSample("Colossus.mp3"));
Music.put(4, minim.loadSample("Crystal Glaciers.mp3"));
Music.put(5, minim.loadSample("Dead Heroes.mp3"));
Music.put(6, minim.loadSample("Glimmer.mp3"));
Music.put(7, minim.loadSample("Monkey.mp3"));
Music.put(8, minim.loadSample("Sunny Villa.mp3"));
Music.put(9, minim.loadSample("swamp.mp3"));
tuioClient = new TuioProcessing(this);
loop();
}