Browse Source

refactoring: fix endless hp glitch

master
Yazan Alaamer 2 years ago
parent
commit
434c1dd96a
  1. 6
      src/main/java/game/StartDarkSoulsGame.java

6
src/main/java/game/StartDarkSoulsGame.java

@ -22,7 +22,7 @@ public class StartDarkSoulsGame {
Container con; Container con;
TitelScreenHandler tsHandler= new TitelScreenHandler(); TitelScreenHandler tsHandler= new TitelScreenHandler();
ChoiceHandler choiceHandler = new ChoiceHandler(); ChoiceHandler choiceHandler = new ChoiceHandler();
int playerHP, monsterHP, AshuraRing;
int playerHP, monsterHP, AshuraRing, fill_hp;
String position, weapon; String position, weapon;
public StartDarkSoulsGame() { public StartDarkSoulsGame() {
@ -197,8 +197,12 @@ public class StartDarkSoulsGame {
} }
public void north() { public void north() {
position= "north"; position= "north";
if (fill_hp < 1) {
mainTextArea.setText("You Are at Siofra River.\n this Water is blessed Drink it. \n (+ 2HP)"); mainTextArea.setText("You Are at Siofra River.\n this Water is blessed Drink it. \n (+ 2HP)");
playerHP = playerHP +2; playerHP = playerHP +2;
fill_hp++;
}
else { mainTextArea.setText("You can only dring 1 time");}
hpLabelNumber.setText(""+ playerHP); hpLabelNumber.setText(""+ playerHP);
choice1.setText("GO south"); choice1.setText("GO south");
choice2.setText(""); choice2.setText("");

Loading…
Cancel
Save