i'm newbe in this programming language (in almost too), i just wanna use a "if and else" with getter and setter methods, i'm doing a basic RPG for learning purpose. I've a character x, and all i wanna do is; if the life of this character is lower than 0 revive this character,else just increase his life. This is my code.
public Skill bless(Character x) {
if (0>= x.getCurrentHp()) {
x.getCurrentHp() == x.getHp() * 3/4;
}
else if (x.getCurrentHp() > 0) {
x.getCurrentHp() =+ x.getHp() * 1/2;
}
return x;
}
Aucun commentaire:
Enregistrer un commentaire