GSimpson
08-01-2006, 11:47 AM
Hey I'm creating a game that has a 6 buttons below some ingame options etc.
Now I'm having problems with my levels and its script.
Below is my script.
<!-- Begin
function stats(){
var armour=3;
var defense=1;
var attack=1;
var total=attack+defense;
var disp=0;
if (disp==0) { alert("Your Attack Level Is:"+attack+"\nYour Defense Level Is:"+defense+"\nYour Armour Bonus
Is:"+armour+"\n_________________\n\nYour Total Level Is:"+total+"\nWith a bonus of "+armour+" Defense Points");}
}
function raiseattack(){
var goupa=0;
if (goupa==0) { alert("You gained One Level In Attack!"); attack=+1;}
}
// End -->
now when I click a button that has this code:
<INPUT TYPE=BUTTON VALUE="Train Attack" ONCLICK="raiseattack()">
The button displays the message that I have leveled up, but doesnt add 1 to the variable atack. so when I view the stats button its still displaying the attack to be one. I need it to raise by one every time this button is clicked.
PLEASE IF POSSIBLE NO ELEMENTS!!! i havent learnt them yet.
Now I'm having problems with my levels and its script.
Below is my script.
<!-- Begin
function stats(){
var armour=3;
var defense=1;
var attack=1;
var total=attack+defense;
var disp=0;
if (disp==0) { alert("Your Attack Level Is:"+attack+"\nYour Defense Level Is:"+defense+"\nYour Armour Bonus
Is:"+armour+"\n_________________\n\nYour Total Level Is:"+total+"\nWith a bonus of "+armour+" Defense Points");}
}
function raiseattack(){
var goupa=0;
if (goupa==0) { alert("You gained One Level In Attack!"); attack=+1;}
}
// End -->
now when I click a button that has this code:
<INPUT TYPE=BUTTON VALUE="Train Attack" ONCLICK="raiseattack()">
The button displays the message that I have leveled up, but doesnt add 1 to the variable atack. so when I view the stats button its still displaying the attack to be one. I need it to raise by one every time this button is clicked.
PLEASE IF POSSIBLE NO ELEMENTS!!! i havent learnt them yet.