hello could help me with a code, I want that when my character touches one or another thing I lower a life and locate it where I start, but what happens is that when I am in another world it does not come out in the position in which it starts, I can do.
This is my code:
int x, y;
x = 298;
y = 42;
if (isTouching (comida.class)) {
cont = cont + 1;
this.getWorld (). showText ("score:" + cont, 500.30);
}
if (isTouching (floor.class) || isTouching (enemy1.class)) {
x = this.getX ();
y = this.getY ();
contlife--;
this.getWorld (). showText ("life:" + contlife, 100.30);
setLocation (y, x);
if (contlife == 0) {
gameov ();
}
}
otherwise, when life is = 0 does not change the world ??
I hope you help me thanks