mana reduction: oh it works! thanks. yourManaBar.style.width = yourMana + "%"; oopsie hehe
heal frequency: how do i get it to heal every time heal button is pressed? ( i have no idea what the floating point stuff is about. not a mathematical person)
heatlh and mana bars: the original code had 100 health for the player and the comp. but my monster has 30 health and my player has 15 health (but the ability to heal, starting with 30 mana). the health and mana bars are almost totally empty when the battle starts as a result because he originally coded the combatants to each have 100 health. problem is, i don't see where the 100 health is mentioned after i changed it to 30 and 15. its effecting what percentage of the health and mana is filled in the healthBars and manaBar when the battle starts.
you win, you lose, etc: there doesn't seem to be a win/lose statement, just a game over statement when one or the other, runs out of health. how do i make it generate a "You win" or a "Granbot wins" statement?
i tried to extract the "c" battle portion from this
Code:
//proccesses the moves to a result
function damageStep(y, c) {
if ( y === 'attack' && c === 'attack') {
res = '';
if (compHealth >= 10 && yourHealth >= 10) {
compHealth -= 1;
yourHealth -= 1;
} else {
compHealth = 0;
yourHealth = 0;
}
and make it a separate function below the "y" section, but it broke the script. in other words, i made this
Code:
if ( y === 'attack' && c === 'attack') {
res = '';
into this
Code:
if (y === 'attack) { res ='You attack!';
if (c === 'attack') { res='Granbot attacks!';
nope. clearly i'm not a javascript coder. learning though.
Bookmarks