![]() ("%n%s, Choose Your Move! \n", player2name) ("You Slice Your Sword At %s! \n", player2name) ("You Thrust Your Sword At %s! \n", player2name) ("%n%s, Choose Your Move! \n", player1name) ("Your health is now at " newHealth1 "!") ("Your health is now at " newHealth "!") ("Gladiator Health: " newHealth "\n\n") ("Your attack does " outcome1 " damage!") Outcome1 = hit.nextInt(100) - hit.nextInt(15) ![]() ("Warrior Health: " newHealth1 "\n") ("Your attack does " outcome " damage!") Outcome = hit1.nextInt(100) - hit1.nextInt(15) Int outcome, outcome1, outcome2, outcome3 So how can I fix my code so the health doesn't restart at 1000 after each attack and it subtracts from the new health that was already been lowered from the previous attacks. I want them to fight until one of there health goes down to 0 and dies. It doesn't have the previous attack subtracted off. It will print out that player two has 920 health. Now player 1 attacks for the second time and lets say he does 80 damage. Then it's player two's turn and lets say he does the exact same thing and takes off some health from player 1. Lets say player 1 chooses thrust and attacks 55 (using random) then my code prints player 2's new health which is now 945. When the battle starts, player 1 gets to choose between three options: 1 - thrust 2 - slice 3 - drink potion. A warrior versus gladiator.īoth of the fighters have 1000 health. I am trying to create a game where there is two fighters.
0 Comments
Leave a Reply. |