Hey guys. I'm sort of new to processing and was wondering if someone could help me out with what seems to be a syntax error. I'm getting an unexpected token error but can't seem to find the problem. I recently converted one program to another which consist of methods now. The problem is probably obvious but I'm apparently blind right now. I'll post my code below. Thanks!
MainGame Code
public class MainGame
{
public static void main (String[] args)
{
float rando;
void setup()
{
size(1000,1000);
int lives=3;
smooth();
}
void draw()
{
background(100, 50, 100);
drawplayer();
drawenemy();
if(nlives==0)
{
println("GAME OVER");
}
if(dist(nlives==0))
{
println(frameCount);
}
if(nlives==0)
{
exit();
}
}
void drawplayer()
{
float xspeedpos=0;
float yspeedpos=0;
float xpos=mousex;
float ypos=mousey;
int lives=3;
Player play = new Player( double xpos, double ypos, int lives);
play.setY(ypos);
play.getY();
play.setX(xpos);
play.getX();
play.moves(xpos, ypos);
play.display();
}
void drawenemy()
{
Enemy enemies = new Enemy[2];
rando=random(400);
enemy[0]= new Enemy (900,500,1,3, rando);
rando= random(400);
enemy[1]= new Enemy(900,500,1,3,rando);
rando= random(400);
enemy[2]= new Enemy(900,500,1,3,rando);
xpos=900;
ypos=500;
xspeedpos=1;
yspeedpos=3;
enemies.getYspeed(yspeedpos);
enemies.setYspeed();
enemies.setXspeed(xspeedpos);
enemies.getXspeedpos();
enemies.setY(ypos);
enemies.getY();
enemies.setX(xpos);
enemies.getX();
enemies.moves();
enemies.display();
if(dist(mouseX-100, mouseY-100, x, y + rand) < 150)
{
nlives=nlives-1;
rando=random(400);
enemy[0]= new Enemy (900,500,1,3, rando);
rando= random(400);
enemy[1]= new Enemy(900,500,1,3,rando);
rando= random(400);
enemy[2]= new Enemy(900,500,1,3,rando);
}
}
}
}
Character Method Code
public class Characters
{
protected float x;
protected float y;
protected float xspeed;
protected float yspeed;
public Characters(float xspeedpos,float yspeedpos,float xpos, float ypos)