There are two variables
var bokser = [];
var userChoice;
var randBokser;
plus the info
bokser[0] = {
name:"bokser1",
life:100,
kick:5,
fight:7,
kill:9
};
bokser[1] = {
name:"bokser2",
life:100,
kick:7,
fight:10,
kill:4
};
bokser[2] = {
name:"bokser3",
life:100,
kick:9,
fight:4,
kill:4
};
how to create an if/else statemt
if(userChoice click on button1){
value of bokser randBokser changes
}
if(userChoice click on button2){
value of bokser randBokser changes
}
else(userChoice click on button3){
value of bokserRandbokser changes
}
the value of the life has to be changed. example: userChoice is bokser1, randBokser is bokser2 user click on button1 life of randBokser 100-5(kick) = 95(randBokser lif)
Aucun commentaire:
Enregistrer un commentaire