switch to if statement is personal preference most of the time
@ascii
O_o the ability to following along yourself doesn't mean the code is messy. Messy code is when you written statements out far longer then they needed to be ( at least thats how I known messy coding to be).
Answer 1) the reason the program always choices attack one is because.. why not. You didn't tell the computer that the choicing of attack she be based on anything all you did was say here are options pick one. The computer will always pick option 1 because to the computer there no difference between choice 1 to x number of choice they are all the same( also a computer does things in procedure 1 to last so if the choice are all the same to the computer it will choice the first). You have to remember that unless you give parameter to the computer ( as in AI and a computer in general) it will do nothing. Remember either define what exactly the computer must do or sent up guidelines that the computer must follow in order to proceed.( just sit back and actually think it must be taken for computer to do what you want it to do)
.
.
.
.
-___- think about it...
.
2) the reason you don't get a change in the enemys health is becomes your not thinking of this like math
I will rewrite what you did in a math example
4-5
..... ok what about 4-5 yes we and the computer knows that 4-5 =9 but thats great the 9 is produce but where does that nine go to... no where because you haven't assign a symbol to = or equate to 9 you notice in math everything always equals to the variable that your looking for be it x,y,z etc.
had you written the following;
4+5=x
9=x
:O!!!!!! now the computer nows where to put the new found variable.
what you should of done is the following
int Newhealth //or variable/name
Newhealth= ehealth-damage
|
Since your battle is only one round this is what I would personally do
then you can either manually type the final couts to show the final health or you can create another function for finalhealth to display.
*** sorry for typos x_x doing this at night***