"Java language" - Help please
I have a class called "Personaje" where I have the variables
int vida = 5;
int randomNumber;
I have another class called "Mago" and I add a Personaje extends to it so that it reads the Personaje variables
At the moment of creating my function, it only reads me the variable of "numberRandom" and if the random number falls in 0,1,2 it sends a print of doing nothing and it works fine, but if it falls 3,4,5 to the variable Personaje vida has to be subtracted by 1, only when it drops to 345, the else if enters fine but it does not subtract in vida. and I want to know how I do it so that if I subtract :l
Personaje Class
Mago class
I run the program, it recognizes the variable numeroRandom the number 4 falls but it does not subtract from life
Recognizes the variable number Random and returns to 2
I have a class called "Personaje" where I have the variables
int vida = 5;
int randomNumber;
I have another class called "Mago" and I add a Personaje extends to it so that it reads the Personaje variables
At the moment of creating my function, it only reads me the variable of "numberRandom" and if the random number falls in 0,1,2 it sends a print of doing nothing and it works fine, but if it falls 3,4,5 to the variable Personaje vida has to be subtracted by 1, only when it drops to 345, the else if enters fine but it does not subtract in vida. and I want to know how I do it so that if I subtract :l
Personaje Class
Mago class
I run the program, it recognizes the variable numeroRandom the number 4 falls but it does not subtract from life
Recognizes the variable number Random and returns to 2