Problema juego java
Tengo que programar un personaje para un videojuego en java, pero me da constantemente el siguiente error: "illegal start of expression line 19".
Aqui dejo el codigo para ver si alguien me puede echar una mano, creo que es algun problema con las llaves, pero no soy capaz de dar con el.
public class Personaje {
private String nombre;
private int numVidas;
private boolean vidas;
private String energia;
public Personaje(String nombre, int vidas) {
public Personaje(int xmax, int ymax) {
x = y = 0;
orientacion = 'N';
this.xmax = xmax;
this.ymax = ymax;
int x, y; //variable
char orientacion; //variable
int xmax, ymax; //variable
public void girar() {
if (orientacion == 'N')
orientacion = 'E';
else if (orientacion == 'E')
orientacion = 'S';
else if (orientacion == 'S')
orientacion = 'O';
else orientacion = 'N';
public void avanzar(int dist) {
public avanzar(int dist) {
if (dist > 0) {
switch (orientacion) {
case 'N':
y += dist;
break;
case 'S':
y -= dist;
break;
case 'E':
x += dist;
break;
case 'O':
x -= dist;
if (x < 0) x = 0;
break;
}
/ switch;
}
/ avanzar;
if (x > xmax) x = xmax;
if (y < 0) y = 0;
if (x < 0) x = 0;
if (y > ymax) y = ymax;
}
}
}
}
public void cogerBono() {
puntos += 100;
}
public string toString();
}
}
Aqui dejo el codigo para ver si alguien me puede echar una mano, creo que es algun problema con las llaves, pero no soy capaz de dar con el.
public class Personaje {
private String nombre;
private int numVidas;
private boolean vidas;
private String energia;
public Personaje(String nombre, int vidas) {
public Personaje(int xmax, int ymax) {
x = y = 0;
orientacion = 'N';
this.xmax = xmax;
this.ymax = ymax;
int x, y; //variable
char orientacion; //variable
int xmax, ymax; //variable
public void girar() {
if (orientacion == 'N')
orientacion = 'E';
else if (orientacion == 'E')
orientacion = 'S';
else if (orientacion == 'S')
orientacion = 'O';
else orientacion = 'N';
public void avanzar(int dist) {
public avanzar(int dist) {
if (dist > 0) {
switch (orientacion) {
case 'N':
y += dist;
break;
case 'S':
y -= dist;
break;
case 'E':
x += dist;
break;
case 'O':
x -= dist;
if (x < 0) x = 0;
break;
}
/ switch;
}
/ avanzar;
if (x > xmax) x = xmax;
if (y < 0) y = 0;
if (x < 0) x = 0;
if (y > ymax) y = ymax;
}
}
}
}
public void cogerBono() {
puntos += 100;
}
public string toString();
}
}
